Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Check for radiohead tickets :(
#!/usr/bin/env python
I really *REALLY* wanted to see Radiohead at Roseland ballroom, but so
did everybody else and the tickets sold out in about 10 minutes. I didn't
get one :(
They haven't played in NYC in 3 years!
Here is a script that checks when tickets become available for an event.
# The urls of the respective events on Ticketmaster
# These urls are for Radiohead at roseland ballroom, which
# sold out in about 5 minutes :(
# Wednesday Show
# Thursday Show
from sys import stdout
import time
import webbrowser
import urllib
from random import randint
# If you have mac we'll use py-appscript (pip install appscript)
# to pop up a modal dialog and say a message through the speakers
import osax
sa = osax.OSAX()
def dialog(msg, **kwargs):
# Give the app focus so the dialog will be on top
# Open the dialog
return sa.display_dialog(msg, **kwargs)
def say(msg):
# Max volume (0 - 7 scale)
# This spelling is for fun pronounciation
sa.say("i finded yer teekutz")
except ImportError:
def dialog(msg, **kwargs):
def say(*args, **kwargs): pass
def printnow(msg):
def randsleep(min, max):
time.sleep(randint(min, max))
def tickets_available_for(event_url):
html = urllib.urlopen(event_url).read()
return "Tickets Not Available" not in html
print "Searching for tickets..."
while True:
for event in EVENT_URLS:
if tickets_available_for(event):
say("i can has yoar teekitz")
dialog("Found tickets!", buttons=["View in browser"])
# ~5 seconds between calls (let's be polite)
randsleep(4, 8)
# ~60 seconds between checks
randsleep(45, 65)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment