Forum: Ruby on Rails Scrape rankings Google

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
28be3be213eeed3f66e0a20f1e20c7ac?d=identicon&s=25 Remco Swoany (zwaan123)
on 2009-02-02 16:52
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
This topic is locked and can not be replied to.