Subscribe to
Posts
Comments

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.

7 Responses to “Xml Feed from the London Underground Real-time status”

  1. on 27 Dec 2007 at 8:51 pmjames

    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. on 08 Mar 2008 at 7:24 amalpriest

    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. on 19 Mar 2008 at 10:43 pmAndy

    Hi Al,

    Nice script :)

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

    Cheers,

    Andy.

  4. on 21 Mar 2008 at 9:19 pmAl

    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. on 21 Mar 2008 at 10:17 pmAndy

    Thanks Al :)

  6. on 02 Jun 2008 at 10:20 amMatt

    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

  7. on 11 Jul 2008 at 5:49 amMalcolm Barclay

    Thanks for releasing under GPL! I have used as the base for a Tube Status application for the iPhone, as per GPL I have published all changes http://mbarclay.net/?p=64

    Cheers,
    Malcolm

Leave a Reply