Web Applications Stack Exchange is a question and answer site for power users of web applications. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What's the best way to export a complete history of my last.fm scrobbles? The data seems to be there on the website so in theory it could be screen scraped if all else fails but is there an easier way?

share|improve this question
up vote 7 down vote accepted

As Backing up Last.FM scrobbles explains you should be able to use the script lastexport.py in LastToLibre. To use it:

  1. Download lastexport.py.
  2. Run it with the following terminal command:

    python lastexport.py -u last.fm_user_name

    Note that this requires you to have Python installed and that you replace last.fm_user_name with your last.fm user name. Also note that if you got real time stats hidden (under privacy settings) you have to enable it for this to work.

  3. You can now find the exported tracks in the same directory as the script. By default it will be named exported_tracks.txt

The script also allows for exporting loved and banned tracks. By default it exports scrobbles but you can change the behavior by setting the flags -t to either loved or banned.

If you want to backup loved songs you can use sync_songs. It requires Ruby which can be installed via

sudo apt-get install ruby1.9.1.

on Debian-based systems. The simplest way to install sync_songs is via RubyGems (which can be installed via sudo apt-get install rubygems1.9.1 on Debian-based systems):

sudo gem install sync_songs

For details and other ways to install see the readme.

To use it with Last.fm you need an API account as described in services.org. It is free and quite easy to get such an account. Once you have an account you can backuo Last.fm loved tracks to a CSV file by first a creating an empty file and then issuing the following

sync_songs sync --color -vs smith:lastfm:loved file_path:csv:library

You need to replace smith with your Last.fm user name and file_path with the path to the empty file.

share|improve this answer

Update: Last.fm now provides a web-based way of doing this: you hit the button, and you get an e-mail with a download link when the data is ready.


share|improve this answer
Update update: the feature is gone, after the recent redesign. – djjeck Aug 21 '15 at 2:05

Maybe there is something at Build Last.fm you could use?

Rather than screen scraping, they do have an api that you could use to pull your library among other functions.

share|improve this answer
Yes, thanks, the answer seems to be the user.getRecentTracks API call with appropriate parameters, see: last.fm/api/show/user.getRecentTracks – akent Feb 25 '12 at 5:17
There is a script to do the export via the API. – N.N. Dec 17 '12 at 15:46

If you have Node.js you can use the lastfmexport command-line utility. It supports line-delimited JSON and tab-separated CSV. It has a very small memory footprint as it continually streams to file instead of buffering the entire scrobble history in memory.

npm install lastfmexport -g
share|improve this answer
Nice. Great tool. Thanks. – gyaresu Mar 13 '15 at 1:31
Thanks! python version crashed at 1MB but this one worked great, plus makes either JSON or CSV, python output looked harder to deal with. – mliqu Aug 19 '15 at 19:38

You can use Ben Foxall's Last.fm to CSV exporter, which will fetch the pages of your history and save it in CSV format. The code is available on Github if you want to incorporate into a JS project.

share|improve this answer

Also, you can export your Scrobbles in XML or CSV with a web utility I wrote. It uses the Last.fm API to pull all your scrobble data into one file you can download. Large libraries (playcount > 100k) do take some time though.

share|improve this answer

As a developer that's really interested in statistics for my own play history, I ended up writing a web-based tool to get my Last.fm scrobble history. While I did find a few tools online, they were either broken and/or required the user to download script files and manually run the backup process on their own computer. In the meantime, I see there are a couple other working, web-based options. If none of the others happen to work for what you're trying to do, give this one a shot. It will back up all of your Last.fm scrobble data by year in JSON format, and allow you to download a .zip file with the full history.

Here's a link to the tool: Last.fm Backup

share|improve this answer
Hi Matt, take a look here – bummi Feb 11 at 6:24
This might also be helpful: Your answer is in another castle: when is an answer not an answer? – Al E. Feb 11 at 17:58
I have undeleted this because of the disclosure, but have only let it stand because this is a broad question that has survived from the olden days. This is an exception due to the effort that has been shown. – jonsca Feb 14 at 0:31

protected by jonsca Feb 14 at 0:31

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.