It isn’t often that my line of work and main passions co-incide, but the frustration of trying to land the London 2012 Olympics tickets that I wanted gave me cause to find a technical solution to my problem.
I’ve blogged before about my limited success in getting tickets for the games. Most of all I wanted tickets, any tickets, for track cycling. These are like gold dust as the venue only holds 6000 people and it is the sport which bears Team GB’s highest chance of medals.
A while ago tickets started to be issued as venue layouts became finalised. In addition the official re-sale process kicked in. This meant that an occasional drip-feed of tickets started to become available on the ticketing web site. There was no advance notice, it was pure luck/co-incidence if something happened to be made available when you looked.
This kind of scenario lends itself nicely to some scripting, so I started looking into the HTML source of the ticketing site to work out how to automate the discovery of ticket availability. The general approach is simple: each session has a unique code and you can perform a search for that session. It then either tells you that tickets are currently unavailable, or allows you to select that session and go on to the ticket selection process.
Therefore a simple script that could poll the session search results page and check for the indication of availability would do the trick, so here it is:
The starting point was this web site monitoring script found via google.
Usage is simply like this:
ticket_watch.pl -e <your email address> <session code>
I utilised an Amazon EC2 micro-instance running Linux then simply set up cron jobs to check the nine track cycling sessions every five minutes. Using cron isn’t perfect – if tickets for a session do become available for a period of time then your inbox might get busy with continual alert emails but that is a minor inconvenience. What’s more annoying is the way that the ticketing site works. There is a significant lag between tickets becoming unavailable and the search results page indicating this fact. These two issues can combine to mean that you continue to get alert emails for quite a while after tickets sell out.
So, does it work? Well I’ve had it running for about two weeks and there have certainly been a lot of tickets drip feeding in during that time. There is no pattern to when, so I could wake up to alert emails sent during the night, or receive them whilst walking the dogs or otherwise not being in a position to do anything about it. However, today I was sat at my desk at work and an alert email came through. I jumped on the site and managed to grab a top-price ticket to the very final track medal session featuring the Women’s sprint, Women’s Omnium and Men’s Keirin. All three events will have very solid possibilities of GB medals.
So, mission accomplished and my EC2 instance has now been retired. There’s still tickets coming in though, and time to grab them so if you are also a bit of a geek feel free to make use of this script!