{"id":405,"date":"2010-07-15T23:25:15","date_gmt":"2010-07-15T22:25:15","guid":{"rendered":"http:\/\/www.nobugs.org\/blog\/?p=405"},"modified":"2010-07-15T23:25:15","modified_gmt":"2010-07-15T22:25:15","slug":"command-line-buses","status":"publish","type":"post","link":"https:\/\/www.nobugs.org\/blog\/archives\/2010\/07\/15\/command-line-buses\/","title":{"rendered":"Command-line buses"},"content":{"rendered":"<p><a href=\"http:\/\/xmlstar.sourceforge.net\/\">Xmlstarlet<\/a>, 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:<\/p>\n<pre lang=\"sh\">\r\ncurl -s 'http:\/\/www.mybustracker.co.uk\/display.php?clientType=b&busStopCode=36253282' | \r\n    xmlstarlet  sel -N x=http:\/\/www.w3.org\/1999\/xhtml -t -m \/\/x:pre -c 'text()' -n\r\n<\/pre>\n<p>The output looks like this (bus number, destination, minutes until arrival):<\/p>\n<pre>\r\n10    WESTRN HARBOUR   14    \r\n10    WESTRN HARBOUR   43    \r\n11    ST ANDREW SQ     10    \r\n11    OCEAN TERMINAL   22    \r\n12    SEAFIELD         4     \r\n16    SILVERKNOWES     3  \r\n<\/pre>\n<p>You can get the bus stop codes from the <a href=\"http:\/\/www.mybustracker.co.uk\/index.php\">bus tracker website<\/a>.  Of course, you could just get the times from there too, but where&#8217;s the fun in that?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 &#8216;http:\/\/www.mybustracker.co.uk\/display.php?clientType=b&#038;busStopCode=36253282&#8217; | xmlstarlet sel -N x=http:\/\/www.w3.org\/1999\/xhtml -t -m \/\/x:pre -c &#8216;text()&#8217; -n The output looks like this (bus number, destination, minutes until arrival): [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-405","post","type-post","status-publish","format-standard","hentry","category-general"],"_links":{"self":[{"href":"https:\/\/www.nobugs.org\/blog\/wp-json\/wp\/v2\/posts\/405","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.nobugs.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nobugs.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nobugs.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nobugs.org\/blog\/wp-json\/wp\/v2\/comments?post=405"}],"version-history":[{"count":6,"href":"https:\/\/www.nobugs.org\/blog\/wp-json\/wp\/v2\/posts\/405\/revisions"}],"predecessor-version":[{"id":411,"href":"https:\/\/www.nobugs.org\/blog\/wp-json\/wp\/v2\/posts\/405\/revisions\/411"}],"wp:attachment":[{"href":"https:\/\/www.nobugs.org\/blog\/wp-json\/wp\/v2\/media?parent=405"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nobugs.org\/blog\/wp-json\/wp\/v2\/categories?post=405"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nobugs.org\/blog\/wp-json\/wp\/v2\/tags?post=405"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}