Posted on 2014-03-07 00:00:00 +0800

This project is sorta in limbo, thanks to the new transperth website being significantly more difficult to scrape.

Those people who live, or have lived in Perth are likely familiar with the government organisation that provides the public transportation facilities, Transperth.

Put simply, I wished to create a more or less simply to use API library in Python to pull data out of their system. I originally thought that this would primarily involve scraping their website, as I had trouble figuring out the location of the API the mobile app used.

I think I have now figured it out, in part;

Train times API

Example; Python interface;

I found a JSON string in

that gave a list of the lines and station names that the API would accept. The example above shows the corresponding URL for the
Perth Underground Stn

Journey Planner API

Root URL;

Silver Rails Journey Planner API:

The SaaS service provides endpoints for reference data (stops, routes, timetable, etc.), a journey planner, a localities index, a nearby stops service, a timetable lookup, and a trip lookup, presumably for trips already determined via the API.

Having rooted my phone, and installing Root Browser to access the android Transperth App’s assets, I was able to retrieve the

for the Silver Rails API, as well as many other settings.

Because I would probably get the shit sued out of me, I don’t feel comfortable sharing the key here.

Anyway, using the ApiKey, I was able to download all the reference data that the app uses which is a rather large amount, and it seems to be downloaded everytime the app is started, at least partially. I shall investigate this further.

The reference data contains info about;

  • ServiceProviderReferenceData - TransPerth, TransBunbury, etc.
  • TransitStopReferenceData - All the train, bus, and presumably ferry stops
  • RouteTimetableGroupReferenceData - Timetables for the routes, routes themselves
  • LandmarkReferenceData - Landmark info -
    Curtin University of Technology
    for example
  • TransportModeReferenceData - Lists the transport modes; School Bus, Rail, Bus, and Ferry
  • RouteReferenceData - Metadata for routes


, I managed to extract an XML file from the
that contains a large number of strings not present in the code I extracted. This is where I retrieved the list of datasets for the Silver Rail Technology API from;

  • PerthDataset
  • BrisbaneDataset
  • BostonDataset

You can insert these into some of the above URLs, along with a an

query parameter, to make use of the endpoint.

I also found some documentation;


7:02PM 8/3/2014

Browsing through the action list on the transperth website, I noticed that it generated a synthetic TAG ON event to account for my incorrect TAG ON at the wrong scanner.