the latest article is about…

ATP 2009 Tournament Calendar

April 09, 2009

The official ATP site has a table showing general information of their 2009 tennis tournaments. My Ruby-fu needs some training, so I decided to scrape that data and build a neat iCalendar file in order to import the tournament events into my Google calendar. All those tourneys at my fingertips is how I like it.

If you just want to import the events into your calendar of choice, you can use one of the following methods to use my public/published ATP 2009 calendar:

Result

The script produces an iCalendar file named atp_tourneys_2009.ics in the folder of the script. The content looks like the following snippet (UID changed):

BEGIN:VEVENT
LOCATION:Brisbane\, Australia
SEQUENCE:0
DTSTART:20090104
UID: ...
DTSTAMP:20090409T122648
DESCRIPTION:Surface: OutdoorHard\; Winners: Stepanek\, RadekGicquel\, Marc 
 /Tsonga\, Jo-Wilfried
SUMMARY:Brisbane International\nATP World Tour 250
END:VEVENT

Google Calendar import

An import of atp_tourneys_2009.ics into Google Calendar successfully creates the events we wanted. A click on an entry shows further event information1 such as location and surface.

The script

The following Github Gist shows my quick solution. It doesn’t feel very clean at all, but it’s working. The Gist can also be found over here on Github. Note that I worked with a locally saved version of the site named atp_cal2009.html. However, the script should also work if the above-mentioned URL is specified at line 88.

As you can see, there is quite some ugly string stuff going on. The current ATP tournament listing at the official site uses all kinds of untidy tricks—numerous whitespaces and breaks—to create the layout they want. A lot of code lines are dedicated to clean up the inner_html to produce nice output.

1 just ignore my local timezone setting of the embedded calendar

April 09, 2009


previous articles & thoughts…

04/2009