Skip to content

Instantly share code, notes, and snippets.

@marcoSanti
Created December 26, 2023 17:40
Show Gist options
  • Save marcoSanti/642525a8fc881b2147b73a75e07fb2a9 to your computer and use it in GitHub Desktop.
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
#!/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
@stefa168
Copy link

What is the correct usage of this script?

@marcoSanti
Copy link
Author

marcoSanti commented Dec 26, 2023

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