Xml Feed from the London Underground Real-time status
June 28th, 2007 by alpriest
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.
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?
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
Hi Al,
Nice script
I was wondering if you could add in the “Last Updated” field into the XML feed?
Cheers,
Andy.
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
Thanks Al
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
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
Would it be possible to provide the link for the rss so i could use it on my Windows PPC.
Thanks
Mani
Hi i really liked your TFL XML.
Do you think is possible to convert the tower bridge schedule in to a .XML file?
http://www.towerbridge.org.uk/TowerBridge/English/BridgeLifts/schedule.htm
Regards