Xml Feed from the London Underground Real-time status

I’ve written a script to parse the London Underground real-time tube status page and convert it into an Xml feed. It caches the output from TfL for 1 minute. If their page structure changes i’ll endeavour to update my parser.

You can get the feed as Xml or HTML. I’ve also started the ball rolling with a Mac OS X Widget (15kb) (download, unzip and install), and a Google Gadget (add http://www.socialanimal.com/tube/status.php?format=google as a custom URL in iGoogle.

Enjoy and let me know if you find any problems with the feed.

UPDATE 13/May/08: TfL are now offering a selection of iGoogle gadgets. At the moment I can’t find an Xml feed, and the XHTML gadget just states ‘loading’ though which is a shame.

UPDATE 8/June/08: I’ve released the source code for this under GPL license so you can use it in your programs. Please read the GPL license to ensure your usage complies. I didn’t write the output caching files i’ve included and I can’t find the original author to check licensing terms.

UPDATE 24/Dec/08: I was notified recently that the feed had broken since TfL updated their site to add their Travel Tools selection, but still no Xml feed! Anyway, i’ve updated my parser code so it’s all working again. I’ve also added another last updated time attribute to the Xml version, it’s expressed in seconds since 1970 (ala Unix).

UPDATE 2/Feb/09: I’ve added an RSS feed format to the status feed. Not sure how useful it’ll be, let me know.

Advertisements

9 thoughts on “Xml Feed from the London Underground Real-time status

  1. james says:

    Hi,

    I love the tube HTML script and I am currently putting a custom homepage for myself. i would love to have a custom tube status indicator. Was it simple to do, how would I go about having something similar on my homepage?

  2. Hi James,

    Two methods – either the XmlHttpRequest object accessible by Javascript which is the primitive used for Ajax. You should be able to use this to fetch the HTML from my server. Alternatively you could use an IFRAME pointing at my script.

    Al

  3. Andy says:

    Hi Al,

    Nice script 🙂

    I was wondering if you could add in the “Last Updated” field into the XML feed?

    Cheers,

    Andy.

  4. Al says:

    Andy,

    I’ve added a new attribute in the Xml field, and also updated all feeds to use the last updated field directly from TfL.

    Al

  5. Matt says:

    Hi Al,

    This is a fantastic, tool that I have some ideas for. But I don’t want to take the piss and keep polling your server.

    Would you be prepared to release the code you used to the general public (under GPL)? So other people (like me) can use and mirror your XML feed.

    Cheers,
    Matt

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s