Skip to content

Instantly share code, notes, and snippets.

@641i130
Last active January 11, 2023 17:38
Show Gist options
  • Save 641i130/6a5cefe7a8084903dec8e9b5743cdf6c to your computer and use it in GitHub Desktop.
Save 641i130/6a5cefe7a8084903dec8e9b5743cdf6c to your computer and use it in GitHub Desktop.
CTA Bus Tracker Cli
#!/bin/bash
# chmod the script and run like this ./ctabus.sh [bus code]
# This gets the times from the raw HTML code sent from the server
# Special thanks to chatgpt for fixing the grep statements!
curl -s "https://ctabustracker.com/bustime/wireless/html/eta.jsp?route=NULL&direction=NULL&id=$1&showAllBusses=on" | grep -oP '<strong.*>(.*?)</strong>' | grep -vE '<strong.*>#[0-9]{1,3}&nbsp;</strong>' | sed -E 's/.*>([0-9]+).*/\1/;t;s/.*>DUE.*/DUE/'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment