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?


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.


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.


  • 8
    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.


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.


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
  • Nice. Great tool. Thanks. – Gareth 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. – Michael Liquori Aug 19 '15 at 19:38

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.


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

protected by jonsca Feb 14 '16 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.