Blogs from the Ranch

< Back to Our Blog

Get Your WWDC sessions into iCal or Google Calendar

Update: Apple has since removed the date and time information from the JSON data. This code will no longer work. It was fun while it lasted, no?

For those of you attending this year’s sold-out WWDC conference in San Francisco, choosing which sessions to attend can be a daunting task. It’s especially daunting considering that Apple still hasn’t officially announced the schedule for these sessions.

Fortunately, Apple was kind enough to format the session data as JSON (available here) and in this trove of data are dates and times for all of the sessions. Thanks to a tip from the excellent Jeff LaMarche, we can process the data and format it in a more calendar-friendly way.

Jeff’s post uses Ruby to format the data in HTML, which is fine for viewing, but not so good for integration with anything else. I decided to run with that theme and convert the code to output an iCalendar format containing all of the session data. Using this script, you can redirect the output to a file and then import that file into Apple’s iCal, Google Calendar, or whatever other client you fancy.

To run this script, you’ll need to install a couple of Ruby gems if you don’t already have them, like so:

$ sudo gem install json icalendar

Once you have those installed (the above instructions work well on most Unix-like systems), you can then run the following script to generate the iCalendar output. Redirect it to a file called, for example, wwdc_sessions_2009.ics, and you can then import that file into your calendar application.

This code is licensed under the public domain, so use it freely. In case the following does not show up well for you, here is a version in Pastie.

Disclaimer: these times have not been officially announced, so the Big Nerd Ranch takes no responsibility for you missing your favorite session or otherwise imperiling your WWDC experience. You’ve been warned.

require 'rubygems'
require 'open-uri'
require 'json'
require 'icalendar'

sessions_data = JSON.parse(open("http://developer.apple.com/wwdc/data/sessions.json").read)["SessionsData"]

calendar = Icalendar::Calendar.new

sessions_data.each do |session|
  calendar.event do
    dtstart DateTime.parse(session["time"][0]["lower"]).new_offset(-7.0/24)
    dtend DateTime.parse(session["time"][0]["upper"]).new_offset(-7.0/24)
    summary session["title"]
    description session["description"]
    location session["room"]
    categories ((session["focus"] || []) << session["level"] << session["type"]).compact.uniq

puts calendar.to_ical

Not Happy with Your Current App, or Digital Product?

Submit your event

Let's Discuss Your Project

Let's Discuss Your Project