THI Timetable is the inofficial Timetable for Students of Technische Hochschule Ingolstadt. It brings your schedule to any device via iCal without having to install an App – you can use your native calendar application!
Background and motivation
Although the university provides a working system, it lacks important features like export or sync functionality. Additionally, the usability is poor: It is written with JSP, making it slow. Another Problem is the layout, which is not optimized for mobile devices. The most annoying aspect of this system is, having you to sign in each time you want to check your timetable.
First I had to analyze the original page. A great tool to look under the hood of a webapp is a browserextension like Firebug. The first step was to reverse engineer the login process to obtain a valid session-id. The prototype of the autenication method looked like this:
Next step is to feed it with username and password and it will send a request to the hiplan-app, parse the result using a regular expression and return the session-id. Now we are logged in, we can dig a little deeper. The hiplan-app uses Ajax to load background-data which turned out to be valid JSON. Fancy! Next we have to parse it. We just transformed the event-jsons to objects, so we can use them to export to any format we want – in this case iCalendar-Format. There is a nice python-library called icalendar which gets the job done. So – next step is to combine all these results and create a first version as a commandline tool. It is available on Github. Just have a look at the examples.
Since the goal is to make this tool accessible to the masses and considering the fact that nobody uses python command line tools, we need a better looking, user-friendly interface. There are several options:
- stay on the commandline-way: small user-base
- Native Apps: Need support for iOS and Android and Windows Phone (just kidding – windows phone was already doomed to fail back in 2014 when I started the project)
- Webapp: Need only one Version for multiple devices / easy to maintain
So I decided for the Webapp. I hosted this service on Googles AppEngine, since it includes everyhing I need: a Python-Webframework called webapp2 that comes with a jinja2-like template system, a data storage which is needed to hold the user data and last but not least probably the most important part: A cron-service to schedule tasks. The system is build on a polling mechanism to scrape the calendar data from the hijacked api, therefore I needed the cron-service to schedule the update-tasks.
If you signed up successfully with your university credentials, your calendar gets parsed for the first time. You will see a success message and a copy-paste text field with a unique url that contains a long, random looking number. This url will point to your calendar in ICAL-Format – a Format which is readable by most native calendar software like google mail, Apple iCalendar, Android etc.. You simply need to pass this link to your calendar software and it will sync on a regular basis. If everything worked as expected, you should see something like this:
The service is online! check it out