Begin forwarded message:

> From: Kurt Dresner <kdresner / cs.utexas.edu>
> Date: February 24, 2006 7:25:49 PM CST
> To: submission / rubyquiz.com
> Subject: Please Forward: Ruby Quiz Submission
>
> This is for the temperature one.
>
> 5 lines:
>
> require 'open-uri'
> open("http://www.google.com/search?q=weather+#{ARGV.shift}") do |page|
>   page.readlines.join =~ /<b>Weather<\/b> for <b>(.*?)<\/b>.*>(\d+) 
> &deg;F/
>   puts "The temperature in #{$1} is #{$2} degrees F."
> end

Begin forwarded message:

> From: Kurt Dresner <kdresner / cs.utexas.edu>
> Date: February 24, 2006 7:32:06 PM CST
> To: submission / rubyquiz.com
> Subject: [UPDATE] Please Forward: Ruby Quiz Submission
>
> Actually, here's a slight improvement:
>
> require 'open-uri'
> open("http://www.google.com/search?q=weather+#{ARGV.join('+')}") do  
> |page|
>   page.readlines.join =~ /<b>Weather<\/b> for <b>(.*?)<\/b>.*>(\d+) 
> &deg;F/
>   puts "The temperature in #{$1} is #{$2} degrees F."
> end
>
> Now you can do anything that google will parse.
>
> -Kurt