lib/webmaster_tools.rb in webmaster_tools-0.1.7 vs lib/webmaster_tools.rb in webmaster_tools-0.1.8
- old
+ new
@@ -91,21 +91,21 @@
# Possible Removal Types are: ["PAGE", "PAGE_CACHE", "DIRECTORY"]
def remove_url(url_with_file, removal_type = "PAGE")
url = CGI::escape norm_url(url_with_file)
page = agent.get(REMOVAL % [url, CGI::escape(url_with_file)])
-
+
page.form.field_with(:name => 'removalmethod').value = removal_type
page = agent.submit page.form
files = page.search(".wmt-external-url").map { |n| File.basename(n.text) }
raise "could not submit URL" unless files.include?(File.basename(url_with_file))
end
-
+
def removal_stats(url, max_results = 100)
url = CGI::escape norm_url(url)
page = agent.get(REMOVALS % [url, CGI::escape(url), max_results])
-
+
removals_array = page.search('.grid tr').collect do |row|
next if row.at("td[1]").nil?
url = row.search('.wmt-external-url').text.strip
status = row.at("td[2]").text.strip
@@ -181,10 +181,10 @@
"X-GWT-Module-Base" => GWT_URL,
"X-GWT-Permutation" => GWT[action][:perm],
"Content-Type" => "text/x-gwt-rpc; charset=utf-8",
})
# debugger
- page.content.scan(/security_token=([^"]+)/).flatten.first.tap do |token|
+ page.content.scan(/security_token\\x3D([^"]+)/).flatten.first.tap do |token|
raise "Empty security Token" if token.to_s.empty?
end
end
def to_key(key)