Ripping MP3s from Last.fm with Linux, Streamripper and LastFMProxy

The tools

- Linux (I’m using Ubuntu)
- Streamripper (I’m using version 1.61.27)
- LastFMProxy
- Last.fm account

Installing LastFMProxy..

wget http://vidar.gimp.org/wp-content/uploads/2006/07/lastfmproxy-1.1.tar.gztar -xzf lastfmproxy-1.1.tar.gz

cd lastfmproxy-1.1/

vi config.py

# Stick your last.fm username and password between the quotes below.
username = “yourusername
password = “yourpassword

Now save the file and exit the editor (vi/nano/mcedit/etc)

Installing Streamripper

Download it.

tar -xzvf streamripper-1.61.27.tar.gz
cd streamripper-1.61.27
./configure
make
sudo make install

In Ubuntu or Debian just do apt-get install streamripper

Running LastFMProxy

First make sure you read the README

cd lastfmproxy-1.1
./main.py &

Note: if you have just created a username on Last.fm you need to “tell” it what kind of music you like, so after running LastFMProxy point your browser to one of these addresses:

http://localhost:1881/lastfm://globaltags/rock
http://localhost:1881/lastfm://globaltags/dance
http://localhost:1881/lastfm://artist/Madonna/similarartists
http://localhost:1881/lastfm://artist/Coldplay/similarartists
There is more information about this in the README

Running Streamripper and ripping MP3s

streamripper http://localhost:1881/lastfm.mp3
Connecting…
stream: last.fm
server name: last.fm Streaming Server
bitrate: 0
meta interval: 16000

[buffering - | ] - Wait…
[ripping… ] The Rapture - Infatuation [ 4.59M]
[ripping… ] Scissor Sisters - Take Your Mama Out [ 4.15M]

The end! :o



Thank you for reading this post. You can now Read Comments (23) or Leave A Trackback.

Post Info

This entry was posted on Friday, March 2nd, 2007 and is filed under HOWTO, Linux.

You can follow any responses to this entry through the Comments Feed. You can Leave A Comment, or A Trackback.



Previous Post: Fedora 7 Test 2 Released »
Next Post: Things to do immediately after installing Firefox »

Read More

Related Reading:

  • No related posts

23 Responses to “Ripping MP3s from Last.fm with Linux, Streamripper and LastFMProxy

  • 1
    Anonymous
    March 3rd, 2007 05:08

    Wow..nice! :)

  • 2
    dimension128
    March 3rd, 2007 06:42

    I kept trying in vain to connect to the stream with xmms at the same time. (and that was probably kind of stupid).
    Is it possible to listen to what streamripper is grabbing?
    That way I can skip junk I don’t want.

  • 3
    W3ird_N3rd
    March 3rd, 2007 07:22

    Streamripper -r and connect to localhost:8000 on xmms.

  • 4
    Arthur
    March 3rd, 2007 10:07

    Most excellent! Now I can stop using the broken and constantly unstable PandorasJar.

    Thought I would recommend this station:

    http://localhost:1881/lastfm://user/bytor4232/recommended/100

    Also, if you use rhythmbox you can configure it to send your tracks your listening to into last.fm. Makes the upper URL a little more accurate.

  • 5
    jake3988
    March 3rd, 2007 10:22

    This is utterly fantastic.

    Streamripper is awesome. It even separates the files itself and names them!

  • 6
    Anonymous
    March 3rd, 2007 12:34

    e, thanks! can I translate to spanish and put in my blog? my.opera.com/suribe ?

  • 7
    Alex
    March 3rd, 2007 12:45

    Sure! But please leave a link to here.

  • 8
    Digital Spaghetti
    March 3rd, 2007 14:35

    Great little hack :) I recommend Yakuake, which is a Quake-style terminal that you can hide by just pressing F12. Nice with this script as you can leave it running and occasionally check on the songs you get.

  • 9
    Anonymous
    March 3rd, 2007 15:06

    Thanks. Just figured it out. Not saving pandora’s music was the only bad part about switching to linux months ago, and you just made things a lot better. I LOVE YOU :).

  • 10
    Sean
    March 3rd, 2007 16:51

    I’m the poster above. Anyway after using it, it seems that it splits up the files and gives them names of songs that lastfm didn’t even play, but which streamripper told me it was downloading and I assumed it was skipped by lastfm because it considered them already played. Case in point. I have a file named Goldfrapp which lastfm didn’t play, and is half?, 1/4? of another file which last fm did play. I’ll play around with it and see what happens though.

  • 11
    Eleftherios Kosmas
    March 3rd, 2007 21:53

    That’s a great How-TO thanks!

  • 12
    DJ Gentoo
    March 4th, 2007 11:39

    I feel stupid saying this for the nth time, but thanks. That was an awesome tutorial. It’s so awesome that I can have FireFox, XMMS, LastFMProxy, and StreamRipper running all at once on a slow laptop with Ubuntu Linux, and still have flawless rips. It’s that good. Thanks a ton.
    PS: Ubuntu users can install StreamRipper with Automatix2.

  • 13
    Anonymous
    March 9th, 2007 23:59

    Thanks, this works really well. My question is, is there a way to get rid of the 1-2 second silence that it records while buffering the next song? I’m on DSL and it could possibly be my connection, but a predominate number of my songs all have 1-2 seconds of nothing at the beginning.

  • 14
    Anonymous
    March 14th, 2007 14:04

    how can I get streamripper to put the album name in the id3 tag. It is available in the web browser.

  • 15
    Anonymous
    March 20th, 2007 20:13

    Very nice! thanks for this tutorial.

    Has anyone figured out how to grab specific tracks though? I can build myself a playlist, and I’d like to be able to specifically grab those tracks, rather than what last.fm is choosing.. any ideas?

  • 16
    Todd
    March 23rd, 2007 18:20

    This is quite possibly the greatest combination of tools ever. Major props on this one.
    I noticed someone asked about streaming and ripping at the same time. I did this:

    1) Using amarok i tuned into the last.fm radio of choice.
    2) With the last.fm proxy tool i started the main.py (while listening with amarok, this shows what you are already listening to)
    3) started the streamripper tool tuning into the http://localhost:1881/lastfm.mp3

    viola streaming and ripping at the same time.

  • 17
    Anonymous
    March 26th, 2007 03:32

    thanks!

  • 18
    grayFalcon
    May 3rd, 2007 17:34

    @Moderator: Sorry for the previous posts. Apparently, the size comparison (uses <) screws up the post, so I’ve uploaded the script and I’m providing a link. Would you be so nice as to delete the 2 previous posts? Thanks!

    Awesome ;) I wish there was something similiar for Pandora though, lastFM’s algo is waaay worse. I tell it that I like Nightwish, and get bombed with death metal and stuff. Well, maybe it’ll learn what I like after a while.

    Btw. I put together this little script to automatically sort the ripped songs into subdirectories by artist. Just into the directory “last.fm”, found in the dir in which you started streamripper, do “chmod +x sort.sh” and “./sort.sh” after each ripping session.

    Have fun everybody!

  • 19
    links for 2007-05-14 « Daily Links Posting
    May 14th, 2007 15:24

    […] Linux Monitor » Blog Archive » Ripping MP3s from Last.fm with Linux, Streamripper and LastFMProxy (tags: last.fm linux mp3 howto ripping) […]

  • 20
    Markus
    September 10th, 2007 19:42

    Well, for me it only works a little bit. It rips the music. But it mixes the songs somehow. The beginning is the rest of the old song. And in the end, the next song already starts. That’s weird. Does someone know how to fix this? Thanks.

  • 21
    Simon
    December 14th, 2007 02:26

    Hi, i can make it work but still got a problem.
    While last.fm proxy reflects exactly what my last.fm player in ubuntu is playing, the streamripper seems to play completely random songs, even songs and genres I’ve never played before. Have you got any sollution to this? I would like to rip my own music

  • 22
    tamm
    February 26th, 2008 15:31

    There are some new versions of lastfmproxy: http://vidar.gimp.org/lastfmproxy/

    You shouldn’t hotlink to the download file.

  • 23
    Samotian
    March 16th, 2008 03:04

    In principle, this setup works fine for me on an NSLU2 with Unslung-FW 6.10 (i.e. Linux). However, LastFM-Proxy doesn’t include metadata about the album (it does display the album title in the website it generates). As I hardly know anything about Perl, I haven’t managed to alter SR’s fetch-external-metadata.pl script. Any ideas about how to save album names (and possibly the covers)?
    Apart from that - very nice!



Leave a Reply

Note: Any comments are permitted only because the site owner is letting you post, and any comments will be removed for any reason at the absolute discretion of the site owner.