public
Last active

Check status of the Tampa Crosstown Expressway’s reversible express lanes in Ruby. Tampa–Hillsborough Expressway Authority doesn’t offer an API, so it uses Nokogiri to scrap the official website’s status display.

  • Download Gist
selmon.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#!/usr/bin/env ruby
require 'rubygems'
require 'open-uri'
require 'nokogiri'
 
doc = Nokogiri::HTML(open('http://www.tampa-xway.com/'))
img_src = doc.css('img.closures').first['src']
 
if img_src.match /West/
puts 'Westbound'
elsif img_src.match /East/
puts 'Eastbound'
else
puts 'Closed'
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.