-
-
Save stormsilver/d3cb0ebf9426f53aea08e8a639ab6d31 to your computer and use it in GitHub Desktop.
Download all Premium playlists from di.fm
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 | |
# Adapted from http://mpd.wikia.com/wiki/Hack:di.fm-playlists | |
URL="http://listen.di.fm/public3" | |
token=$1; dir=$2 | |
if [ "$dir" == "" -o "$token" == "" ]; then | |
echo "Usage: $0 TOKEN PATH_TO_SAVE" | |
echo "Example: $0 0123456789abcdef0 /var/lib/mpd/playlists" | |
echo "Dont know your TOKEN? Access: http://www.di.fm/member/listen_key" | |
echo "" | |
echo "All playlists are 256k" | |
exit | |
fi | |
mkdir -p $dir | |
for name in `wget -q -nv -O - ${URL} | grep -o '"key":"[^"]*"' | sed 's/"key":"\([^"]*\)"/\1/g'`; do | |
echo "Downloading.. ${name}" | |
file="$dir/di-${name}.pls" | |
server=$((1 + RANDOM%4)) | |
cat <<PLS > $file | |
[playlist] | |
NumberOfEntries=1 | |
File1=http://prem${server}.di.fm:80/${name}_hi?${token} | |
Length1=0 | |
PLS | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment