Skip to content

Instantly share code, notes, and snippets.

@marcoSanti
marcoSanti / statoTrenoTrenitalia.sh
Created December 26, 2023 17:40
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'