Skip to content

Instantly share code, notes, and snippets.

@Voronenko
Created March 4, 2016 07:56
Show Gist options
  • Save Voronenko/efb0bfa973a12643bf52 to your computer and use it in GitHub Desktop.
Save Voronenko/efb0bfa973a12643bf52 to your computer and use it in GitHub Desktop.
Here is how to extract an m3u playlist from tunein.com, still in linux. ; credits - http://m3u.domtardif.info/posts/g%C3%A9n%C3%A9rer-une-liste-m3u-de-radio-%C3%A0-partir-de-tunein-radio/index.en.html
###genm3uplaylist.sh
# Execute ./genm3uplaylist.sh SOURCE
# the output will be SOURCE.m3u
grep 'http' "$1" | sed 's/\t//' | tr -d '\r' | xargs -i curl -s -w '\n' {} | grep StreamUrl | sed 's/^[^[]*description/description/' | sed -r 's/(,"Logo").*//' | sed 's/,"broadcast".*,"StreamUrl":/,"StreamUrl":/' | sed -r 's/,"Premium.*//' | grep http | sed 's/","/\n/' | sed 's/description":"/#EXTINF:-1\ group-title="radio"\ radio="true",/' | sed 's/StreamUrl":"//' | sed 's/"$//' > rawlist
grep 'http' rawlist | xargs -i curl -s -w '\n' {} | sed -r 's/^.*"(AAC|MP3)","Url": "//'| sed 's/",".*//' > interm
cInterm=1
let "cRaw=1"
OUTPUT="${1}.m3u"
#echo '#EXTM3U' > $OUTPUT
echo '' > $OUTPUT
while read p; do
sed -n $cRaw,${cRaw}p rawlist >> $OUTPUT
echo $p >> $OUTPUT
let "cRaw=$cRaw + 2"
done < interm
rm rawlist
rm interm
http://tunein.com/radio/CBC-Radio-One-Montreal-885-s25436/
http://tunein.com/radio/CISM-893-s24807/
http://tunein.com/radio/899-Kic-Country-Montreal-s148941/
http://tunein.com/radio/CKUT-903-s31297/
http://tunein.com/radio/Radio-VM-913-s16572/
http://tunein.com/radio/Radio9-919-s47769/
http://tunein.com/radio/The-Beat-925-s31139/
http://tunein.com/radio/CJMC-FM-927-s108564/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment