Created
December 26, 2023 17:40
-
-
Save marcoSanti/642525a8fc881b2147b73a75e07fb2a9 to your computer and use it in GitHub Desktop.
Fetch trenitalia speed and delay from the terminal to avoid the slow and bloated page of portalefrecce
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 | |
while true ─╯ | |
do | |
DATA=$(curl -s https://d6o.portalefrecce.it/PortaleFrecce/infoViaggioActionJson) | |
clear | |
SPEED=$(echo $DATA | jq '.speed') | |
DELAY=$(echo $DATA | jq '.delay2') | |
TRAIN=$(echo $DATA | jq '.tracknum') | |
FROMTO=$(echo $DATA | jq '.tracktitle') | |
echo "Train number: $TRAIN: \n\tfrom $FROMTO \n\ttraveling @ $SPEED Kmh with $DELAY of delay" | sed 's/"//g' | |
sleep 2 | |
done |
while connected to trenitalia provided wifi inside a train, just run the script inside a terminal. you might be required to change the endpoint but it can be found by inspecting the network traffic going on in the train status page
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What is the correct usage of this script?