Backing up Last.FM scrobbles

  • Update 2016: Last.fm have taken that URL down again – I’d advise using the script as detailed below. I’ve tweeted Last.fm about the problem. This online service seems to be working for generating a backup: http://benjaminbenben.com/lastfm-to-csv/
  • Update 2014:  Somewhere this year, Last.fm included an web-based way of doing this yourself: http://www.last.fm/settings/dataexporter – method below still works, and is more suited for a scheduled job-type of setup.

One of the golden rules I’ve been applying lately is that no cloud service lasts forever. We’re all happily using Facebook, Gmail, … to store our data, and it’s all fine and dandy, but I prefer to have local backups of everything, just in case. One could argue that my measly backup scheme pales in comparison to the data duplication these cloud giants do themselves at datacenters spread around the world. A valid point, but what if you suddenly get denied access to that data? (I refer to the MegaUpload case.)

I was reminded of this fact last week, when  the social network of Wakoopa offered every user a batch download of the information they gathered over the years. Wakoopa is reforming, and is shutting down it’s social app-finding network. It’s nice to see they are caring about their user’s data, but we can’t trust every company to be this friendly.

So I’ve been looking for ways to automatically download and save data from web services I love to use. I download most of my data to Dropbox. But wait, that’s a Cloud Service too! Another valid point, but I’ve installed the Dropbox daemon on several machines on several locations – Dropbox holds a copy of my data on their servers, but all my local machines duplicate this data too. I could roll my own syncing service using rsync or alternatives (like the interesting OwnCloud), but for now, it’s convenient enough. And I backup Dropbox to external HDD’s daily.

What with security, you say? All data I gather  is encrypted using 7-zip’s AES-256 encryption algorithm before it gets dumped into the Dropbox folder. Safe enough.

I’m planning on writing a few blog articles with tips on how to download precious web service data. Today: Last.FM. I’ve been using this service since 2006, and scrobbled over 100 000 songs – a hefty amount of my music listening behaviour!

I found backing up these scrobbles on Linux is easiest using this lastexport.py python script, which was developed to move your data from Last.FM to similar service Libre.fm, but works just fine for downloading your scrobbles (more info on that on this page). The syntax is easy:

./lastexport.py -u (username) -o ~/Dropbox/last_tracks.txt

The script doesn’t need a password, since all your scrobbles are public – they’re just spread over a lot of paginated lists (2615 pages and counting, in my case). Just sit back while the script downloads them all, and writes your scrobbles in cleartext to the text file.

The python script should work fine on Windows too, but if you’re not comfortable running scripts, it seems like a GUI was developed by these guys here.

Keep your data safe, see you next time!

Comments are closed.