If you listen to web-based radio stations on a regular basis, you’ve propably wondered, “Is there a way to save this song to my hard drive?” Some MP3 players offer this funcionality, but are seriously lacking in the features department: They save the songs as WAV files, do not split them, ignore the ID3 tags sent by the server or, worst of all, do all of this at once. Some people try to get around this by writing down the name of the song and searching for it later on P2P systems like Kazaa, Lopster or eDonkey. It might work, but probably not so well if you like to listen to less popular genres or groups. After searching for a better solution for quite some time, I literally stumbled upon it the other day: A little piece of GPLed software called StreamRipper.
Usage is simple. After compiling and installing the software (in the usual ./configure, make, make install
way), call StreamRipper (which is a command-line tool) with streamripper http://IP_adress_or_URL_of_the_station:port
. If you are behind a proxy server, specify the server’s address and port with the -p
switch. Upon startup StreamRipper will create, in your current working directory (this behaviour can be modified with the -d
switch, which lets you select another one), a directory with the name of the station you want to rip. Inside this directory goes all the songs ripped, identified by title and artist (as broadcasted by the station), and another directory, called Incomplete
, which will host, you guessed it, incomplete files, usually the first and the last ones of your ripping session. Duplicate songs also go there.
If you want to listen to the station while you are ripping it, there’s no need to open another connection. You can tell StreamRipper to create a “relay server” with the -r
switch, by default on port 8000. So you just need to tell your MP3 player to connect to http://localhost:8000
and start listening. Port 8000 already in use? No problem, StreamRipper can scan for available ports and print this information on the terminal so you know which port to connect to. The paranoid among us who don’t like the idea of having ports scanned can disable this behaviour, with the -z
switch.
The software works remarkably well, even better if you have broadband, to guarantee the bandwith and avoid packet loss (which reflects on annoying beeps or periods of silence on the audio. Note that this is not StreamRipper’s fault), and can find a high quality station, streaming at 128 Kbps (or even 192 Kbps). The song separation mechanism works by detecting periods of silence between two songs. This works well, unless your station is crossfading between them. If this happens, the songs will probably have 1 or 2 seconds of the previous one at the beggining. Annoying, but if the song is worth it I usually cut this part with a sound editor and save the rest.
The only cons about StreamRipper are that it only works with Shoutcast/Icecast-based stations streaming in MP3 format, but those are the vast majority on the Web. Windows Media, Quicktime, Real and other formats, including Ogg Vorbis (for now) are out. It also does not work with the streaming service provided by Live365.com. It used to, but the author was forced to remove this feature under threat of suit for violating the service’s terms of use.
One point worth of mentioning is that StreamRipper is multi-platform. There are versions for Unix (Linux, BSD, etc.), Windows (and a WinAmp plugin) and Mac OS X. I tried the OS X version on my iMac and althought the GUI needs some work (it’s counter-intuitive), it works as well as the command-line version, with some extra features (like the ability to retrieve station listings from Shoutcast.com, or drag’n’drop items from iTunes)
More info