Command-line buses

Xmlstarlet, aka sed for xml, makes it easy to find out when the bus is going to arrive at a stop in Edinburgh without having to leave the command line:

curl -s 'http://www.mybustracker.co.uk/display.php?clientType=b&busStopCode=36253282' | 
    xmlstarlet  sel -N x=http://www.w3.org/1999/xhtml -t -m //x:pre -c 'text()' -n

The output looks like this (bus number, destination, minutes until arrival):

10    WESTRN HARBOUR   14    
10    WESTRN HARBOUR   43    
11    ST ANDREW SQ     10    
11    OCEAN TERMINAL   22    
12    SEAFIELD         4     
16    SILVERKNOWES     3  

You can get the bus stop codes from the bus tracker website. Of course, you could just get the times from there too, but where’s the fun in that?