Skip to content

Instantly share code, notes, and snippets.

@raykrueger
Created March 20, 2013 14:35
Show Gist options
  • Save raykrueger/5205138 to your computer and use it in GitHub Desktop.
Save raykrueger/5205138 to your computer and use it in GitHub Desktop.
A stupid script for watching the lollapalooza ticket page :)
source "https://rubygems.org"
gem "timers"
gem "nokogiri"
#!/usr/bin/env ruby
require "bundler/setup"
require "open-uri"
require "digest/sha1"
Bundler.require
@last_signature = nil
def check_for_changes
doc = Nokogiri::HTML(open("http://www.lollapalooza.com/tickets/"))
element = doc.css("div.ticket-choice.tc-soon").first
signature = Digest::SHA1.hexdigest(element.to_s)
if @last_signature && @last_signature != signature
puts "CHANGED!"
raise "BOOSH"
elsif @last_signature == nil
puts "first run"
else
puts "no change"
end
@last_signature = signature
end
timers = Timers.new
check_for_changes
timers.every(60) { check_for_changes }
loop { timers.wait }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment