Last active
January 11, 2023 17:38
-
-
Save 641i130/6a5cefe7a8084903dec8e9b5743cdf6c to your computer and use it in GitHub Desktop.
CTA Bus Tracker Cli
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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} </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