Skip to content

Instantly share code, notes, and snippets.

@fernandes
Last active June 24, 2019 19:16
Show Gist options
  • Save fernandes/9442984 to your computer and use it in GitHub Desktop.
Save fernandes/9442984 to your computer and use it in GitHub Desktop.
Download all playlists from di.fm
#/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
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"
wget -q -nv -O $file "http://listen.di.fm/premium_high/${name}.pls?${token}"
done
@gregoryStarr
Copy link

Word!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment