Wednesday, June 01, 2011

Back up grooveshark playlist

I've made a script that will back up any Grooveshark playlist and make both a plain text and a html copy (the latter can be opened in a browser and it will be instantly loaded by grooveshark).

The commands are;

# Pull the name of the playlist from the URL

playlistname=`echo $1 | sed "s/\// /g" | awk '{print $4}'`

# Grab the HTML from the URL

wget -O $playlistname.html $1

# Now parse the HTML and extract the songs, then strip the HTML tags

awk '/Songs on Playlist/, $NF ~ /noscript/' $playlistname.html | sed -e :a -e 's/<[^>]*>//g;/ $playlistname

cat $playlistname

Put these commands inside a file (called for example "") and make it executable

chmod u+x

then run it with the URL of the grooveshark playlist


This should produce files Adam+Curtis and Adam+Curtis.html

To convert playlists from iTunes, Spotify and LastFm into Grooveshark I recommend the Groovylists service


Kristian said...

Thanks for this script. The awk line has a missing closing quote. I tried changing final the slash to a quote and it works better. Also the last two lines were missing .html, i.e. $playlistname.html

hitchhiker said...

Cheers for the comments Kristian. I'm glad the script got you some way to making a script that you found useful.