All pastes #612114 Raw Edit

Miscellany

public ruby v1 · immutable
·published 2007-07-10 06:04 UTC
rendered paste body
require 'rubygems'require 'open-uri'require 'hpricot'q = "user_query"url = "http://www.google.com/search?q=#{q}"doc = Hpricot(open(url).read)first_url = (doc/"div[@class='g'] a").first["href"]puts "This is the numer one result in google"puts first_urlputs "\n\r This is the google search url"puts url