Skip to content

Instantly share code, notes, and snippets.

@feddynventor
Last active November 30, 2023 14:28
Show Gist options
  • Save feddynventor/59b66bdd862f045fdf063d6964507a1a to your computer and use it in GitHub Desktop.
Save feddynventor/59b66bdd862f045fdf063d6964507a1a to your computer and use it in GitHub Desktop.
Riproduce l'ultimo Giornale Orario di RTL 102.5
#!/bin/bash
#Browse through past hours files
it=$(date +"%H")
#First iteration URL
httpcode=$(curl -I https://cloud.rtl.it/RTLFM/on-demand/giornale-orario/$(date +"%Y%m%d")/go_$it.mp3 2>/dev/null | head -n 1 | cut -d$' ' -f2)
while [ "$it" -gt "00" ] && [ $httpcode -ne "200" ]; do
echo $it
echo $httpcode
it=$((10#"$it"-1))
if [ "$it" -le 9 ]; then
it=0$it
fi
#Continue checking for availability
httpcode=$(curl -I https://cloud.rtl.it/RTLFM/on-demand/giornale-orario/$(date +"%Y%m%d")/go_$it.mp3 2>/dev/null | head -n 1 | cut -d$' ' -f2)
echo $(date +"%Y%m%d")/go_$it.mp3
done
echo "https://cloud.rtl.it/RTLFM/on-demand/giornale-orario/$(date +"%Y%m%d")/go_$it.mp3"
mpv "https://cloud.rtl.it/RTLFM/on-demand/giornale-orario/$(date +"%Y%m%d")/go_$it.mp3"
#wget "https://cloud.rtl.it/RTLFM/on-demand/giornale-orario/$(date +"%Y%m%d")/go_$it.mp3" -O ./giornaleorario.mp3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment