Scrape rankings Google


#1

Hi,

i use the code to scrape google search results.

require ‘rubygems’
require ‘scrubyt’

google_data = Scrubyt::Extractor.define do
fetch ‘http://www.google.nl/
fill_textfield ‘q’, ‘ticket’
submit

link_title “//a[@class=‘l’]”, :write_text => true do
link_url

end
end

p google_data.to_hash

This output:

[{:link_url=>“http://www.ticketmaster.nl/”,
:link_title=>“Ticketmaster.nl: Welkom”}

The next thing is to store the ranking based on their position