Skip to content

Instantly share code, notes, and snippets.

@bjesus
Created October 25, 2023 09:15
Show Gist options
  • Save bjesus/80b7839c83d0f5f9a339cf7a343ee1d5 to your computer and use it in GitHub Desktop.
Save bjesus/80b7839c83d0f5f9a339cf7a343ee1d5 to your computer and use it in GitHub Desktop.
GVB station departures
#!/bin/sh
echo '[5,"/stops/09900"]' | websocat wss://maps-wss.gvb.nl/ -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/119.0' | tail -n +2 | while read -r line; do printf '%s\n' "$line" | jq -r '.[2]' | jq -r '.trip.lastCallMade.plannedDepartureAt + " " + .journey.publicLineNumber + " " + .journey.destination + " (" + .trip.lastCallMade.status + ", " + (.trip.lastCallMade.delay|tostring) + " delay)"'; done
@bjesus
Copy link
Author

bjesus commented Oct 25, 2023

You need websocat and jq for this to work. Get your station number from https://reisinfo.gvb.nl/ - check the URL after clicking your station on the map. Use the station number instead of 09900 in the script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment