Record from Last FM with Wireshark

I have recently started using the excellent rhythmbox player to listen to last FM but I have noticed that it does not seem to have an easy way to actually record music.   It will play music, but once a favorite track has finished there is no easy way to play it again which is quite frustrating!

I have tried to find where they are cached on the hard disk, but there does not seem to be an obvious location so I thought I’d capture the tcp stream using wireshark.

What I have found works quite well is to set up the a live capture with name resolution active and then play a song you want to capture.   Once the song has started playing you then right click on the live capture and hit “follow tcp stream”

You will then see a box showing text like this:

GET /user/xxxxxxxxxxxxxxxxxxxxxxxx.mp3 HTTP/1.1
Host: kingpin5.last.fm
Connection: close
icy-metadata: 1
User-Agent: GStreamer souphttpsrc libsoup/2.24.1
HTTP/1.1 200 OK
Content-Type: audio/mpeg
Content-Length: 3884093
Cache-Control: no-cache, must-revalidate

You then hit the “save as” button and save it as a “*****.mp3” name of your choice.

Advertisements

5 thoughts on “Record from Last FM with Wireshark”

  1. I tend to use the online player rather than the embedded web player.

    There are almost certainly easier ways to record from last fm but I was just trying to see if it could be done. It can but it’s a bit “hit or miss”.

  2. In case you are still using wireshark to record last.fm streams, I found a little more convenient way to do this:

    first, use the following capture filter to log only the data you receive from the last.fm servers. that way you can surf the net while listening to the music without risking a memory-overflow/thrashing/etc. “net 195.24.0.0 mask 255.255.0.0”

    then you start your capture and begin listening to the music. in wireshark you enter “http.content_type contains audio” as a display-filter. Whenever a song finishes, the Stream gets reassembled automatically and is displayed in the main window. Now you only have to save the contents of the http-package as an mp3 file (click on “Media Type : audio/mpeg”, click “Stop”-Button and press CRTL+H)

    Enjoy :)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s