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?
- Download lastexport.py.
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_namewith 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.
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
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.
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
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