require 'rubygems' require 'cgi' require 'open-uri' require 'hpricot' q = %w{meine kleine suchanfrage}.map { |w| CGI.escape(w) }.join("+") url = "http://www.google.com/search?q=#{q}" doc = Hpricot(open(url).read) lucky_url = (doc/"div[@class='g'] a").first["href"] system 'open #{lucky_url}'
http://scrubyt.org/scrapin-google-in-no-sec/
You need to create an account or log in to post comments to this site.
Result:
For those who think this is not robust (it isn't indeed, since if you change the search query, it breaks), scRUBYt! is able to export a production extractor: