Created
April 21, 2011 11:38
-
-
Save danhigham/934246 to your computer and use it in GitHub Desktop.
Hpricot script to extract sunrise and sunset dates from http://www.timeanddate.com/worldclock/astronomy.html
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/ruby | |
require 'rubygems' | |
require 'open-uri' | |
require 'hpricot' | |
doc = Hpricot(open("http://www.timeanddate.com/worldclock/astronomy.html?n=136&month=12&year=2010&obj=sun&afl=-11&day=1")) | |
sunrise_rows = (doc/"table.spad tr") | |
sunrise_rows.each do |x| | |
puts "Date: #{(x/"td:eq(0)").text}" | |
puts "Sunrise: #{(x/"td:eq(1)").text}" | |
puts "Sunset: #{(x/"td:eq(2)").text}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment