Download shows from OE1 Radio
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/sh | |
# Downloads shows from OE1 | |
# | |
# Usage: | |
# ./orfradiodl.sh http://oe1.orf.at/programm/20180228/504777 | |
# | |
# URL: https://gist.github.com/decke/672e63bee5001fe520aaf73502f095ae | |
parseJsonValue() { | |
KEY=$1 | |
awk -F"[,:}]" '{for(i=1;i<=NF;i++){if($i~/'$KEY'\042/){print $(i+1)}}}' | tr -d '"' | sed -n 1p | |
} | |
DATE=`echo $1 | cut -d'/' -f5` | |
ID=`echo $1 | cut -d'/' -f6` | |
CHANNEL=`echo $1 | cut -d'/' -f3 | cut -d'.' -f1` | |
USERAGENT="Mozilla/5.0 (X11; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0" | |
JSONDATA=`curl -s -X GET https://audioapi.orf.at/${CHANNEL}/api/json/current/broadcast/${ID}/${DATE}` | |
LOOPSTREAMID=`echo "${JSONDATA}" | parseJsonValue loopStreamId` | |
TITLE=`echo "${JSONDATA}" | parseJsonValue title | sed 's/[^a-zA-Z 0-9-]//g'` | |
PROGRAM=`echo "${JSONDATA}" | parseJsonValue programTitle | sed 's/[^a-zA-Z 0-9-]//g'` | |
DOWNLOADURL="https://loopstream01.apa.at/?channel=${CHANNEL}&id=${LOOPSTREAMID}" | |
printf "CHANNEL:\t%s\nTITLE:\t\t%s\nPROGRAM:\t%s\nURL:\t\t%s\nJSON:\t%s\n" \ | |
"${CHANNEL}" "${TITLE}" "${PROGRAM}" "${DOWNLOADURL}" "${JSONURL}" | |
curl -A "${USERAGENT}" -o "${CHANNEL} ${PROGRAM} ${TITLE} ${DATE}.mp3" "${DOWNLOADURL}" |
Danke, ist repariert!
loopstream01 wurde scheinbar auf https migriert, script wurde angepasst und funktioniert jetzt wieder
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Schlüsselwort function mit () in Zeile 17 produziert Fehler. Einfach function löschen und alles funkt bestens.