LastFM to CSV

I made lastfm to csv - a page for downloading lastfm listening data as a csv file. API requests are made directly from the browser, avoiding the need for any server-side code.

give it a shot now (my username is benjaminf)

My friend Andy wanted some lastfm listening data for a visualisation project so I wrote him a ruby script that uses the user.getrecenttracks method to get the track history for a user. This worked fine though if someone else wanted to use it - they would need to install ruby, and have a familiarity of the command line.

I figured it might be easier for people to do this in the browser - so I put together lastfm-to-csv, which lets you enter a username and download a csv file containing all the tracks for a user.

lastfm-to-csv

Using the browser

Generating a csv of all the tracks requires many requests to the api, these need to be processed and combined together. I decided to do this all from the browser, by using xhr to make requests to the api and storing the processed csv data in a javascript Blob.

A few libraries that I found useful:

A few things I noticed by doing it this way:


Andy blogged about his awesome last fm visualisations, you should check them out - turns out that I’m quite obsessive.