Created
January 20, 2012 03:37
-
-
Save stevenocchipinti/1644819 to your computer and use it in GitHub Desktop.
Tramtracker
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 'open-uri' | |
unless ARGV[0] | |
puts "Usage: #{$0} <stop-id>" | |
exit 0 | |
end | |
# Configuration | |
url = "http://www.tramtracker.com.au/?id=#{ARGV[0]}" | |
regex = /\d*\) Rte (\d*)<br>\r\n(\d*)/ | |
open(url).read.scan(regex) do |matches| | |
puts "Route #{matches[0]} arriving in #{matches[1]} minutes" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment