Created
June 9, 2009 23:07
-
-
Save djones/126885 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'hpricot' | |
require 'open-uri' | |
query = "//table//table//table//td/font/b" | |
html_doc = Hpricot(open("http://www.ccc.govt.nz/weatherdata/waterweb.htm")).search(query) | |
temperature = html_doc[0].inner_html.to_f | |
windchill = html_doc[1].inner_html.to_f | |
message = "It is #{temperature} degrees outside in Christchurch with a windchill of #{windchill} degrees" | |
puts message | |
`say #{message}` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment