Candid’s brain

Properly ripping last.fm streams

I’d been looking for a proper way to rip last.fm streams for a very long time. All rippers I could find (like TheLastRipper) are only able to rip lastfm:// URLs, which might be useful to get a lot of songs of a specified tag and then pick out the good ones, but if you are looking for a specific song that is playable on Last.fm in full length, a lastfm:// URL does not exist, the song is only playable via the Flash plug-in.

My solution of the problem is a combination of the Firefox plug-ins BetterCache (unstable version 1.24 works on Linux) and CacheViewer. BetterCache allows you to overwrite the HTTP caching instruction headers, thus to force Firefox to cache files that it should not following the HTTP standard (such as Last.fm MP3 files or YouTube Flash videos). CacheViewer provides you with a GUI for the about:cache list. By searching the cached files for the MIME type audio/mpeg and the host name ^s\d+\.last\.fm$ (s*.last.fm, * standing for a number), you can easily copy the cached MP3 files to your hard drive.

Be careful with the BetterCache add-on. In the default configuration, it modifies Firefox to use the cache for all files not transfered over SSL, which is in most cases not the behaviour you desire. If you want to enable BetterCache only for specified MIME types, remove the wildcard entry from the “Always-cache list” and add it to the “Never-cache list”. Also make sure that “Never-cache list works as ignore list” is enabled.

At the moment, BetterCache does not seem to support wildcards in URLs. Personally, I added audio/mpeg for all URLs to the “Always-cache list”. As soon as wildcards are supported, you may enable it only for *.last.fm.

Filed under bugs

Comments are closed.