Skip to content

Instantly share code, notes, and snippets.

async fetchBusPredictions() {
const response = await fetch('http://countdown.api.tfl.gov.uk/interfaces/ura/instant_V1?StopCode1=74804&DirectionID=1&VisitNumber=1&ReturnList=StopCode1,StopPointName,LineName,DestinationText,EstimatedTime,MessageUUID,MessageText,MessagePriority,MessageType,ExpireTime');
const reader = response.body.getReader().read().then(({ value }) => {
let string = new TextDecoder('utf-8').decode(value);
let split = string.split(']');
// Remove blank at end
split.pop();
// Remove unneeded first array
split.splice(0, 1);
let count = 0;

Keybase proof

I hereby claim:

  • I am joegrice on github.
  • I am joegrice (https://keybase.io/joegrice) on keybase.
  • I have a public key ASBDVmgVt3TKQlDY2WRQ-ddNXC_G0_0Tqz2xesn9WIqsYgo

To claim this, I am signing this object: