Ripping NPR to MP3 for an iPod

I bought an iPod Photo just before Thanksgiving and I’ve been enjoying it ever since. I bought it primarily for the gym and for traveling, and it’s worked well for both of those. However, I thought the sessions on the elliptical machine might be more fun with some news or a talk show to listen to.

I listen to NPR in the car anyway and have often wished that I could time shift their shows (a “TiVo for radio”, if you will). Of course, none of their shows are available in MP3 format (well, except for On The Media). I was aware that many NPR stations offered MP3 streams off their websites, but I still didn’t have a way to record and schedule recordings.

After some searching, I discovered Streamripper, a command line utility that records MP3 streams. I then found PublicRadioFan.com which lists the MP3 streams for hundreds of NPR stations. Putting those together, I’ve been able to record NPR as MP3s and, with some scheduling, grab individual shows for my iPod.. Here’re the steps which I went through, in case you wanted to try this on your own. I run this on my PC but this process may be adaptable to other platforms as well (in particular, I’m pretty sure Linux or FreeBSD could be made to work).

  1. First, download the latest version of Streamripper and extract the zip to a directory of your choice (I put mine in “C:\Program Files\Internet\Streamripper\”).

  2. Then, load up PublicRadioFan and set your time zone and, if you like, you can set some other preferences as well. But, be sure to set your time zone — if you don’t, none of this will work.

  3. After that, it’s time to start looking for programs which you’d like to record. So, head over to the Schedule Grid: Advanced Options page. Here’re the settings which I’d recommend:

    • What time? — choose the “starting at” radio button along with “6 hours”. Then, it’s just a matter of choosing a day and time which is kinda close to a program which you’d like to record. So, for Morning Edition, you could choose 5:00am; or, for Marketplace, you could try 2:00pm (keeping in mind that those represent 5:00-11:00am and 2:00-8:00pm, respectively).

    • What Stations? — you could leave this at the default or you may find that setting it to “USA” (assuming you live in the USA) may yield more relevant results (since Europe probably doesn’t have many NPR affiliate stations).

    • What audio formats? — since Streamripper can only grok mp3s, you should uncheck all of these except for “mp3”.

    • What programs? — feel free to narrow this down but “all programs” is probably fine to start; you can always narrow it down later if you end up with too many results.

    • Display format — I find that the “grid” is easiest to work with.

  4. After all that, click on “display listings” to get a list. Look through the programs to find one which you’d like to record and, once you’ve found one, right click on the lightning-bolt icon next to it (the Winamp logo) and choose “Save Link As” to save the link to your local drive. Yeah, this may seem a bit weird, but those links only point to a playlist and we need the URI for the actual mp3 stream.

  5. At this point, it may be helpful to open up a text editor to make a few notes. Anyhow, once you’ve downloaded the playlist file (which should have the extension “m3u”), open that file in another text editor window and copy the path in there to your “notes” text file. Then, going back to your web browser, make a note of these attributes from the show which you’d like to record:

    • Its name
    • Its starting time
    • The recording time, in seconds (which would be 60 x the time in minutes)
  6. Now it’s time to build the batch file (we’re almost there!). Open a third text editor window and enter these two lines:

    • C:\path\to\streamripper.exe http://servername.net:12200 -a D:\path\to\name-of-the-show.mp3 -s -l 7200 -o
    • del D:\path\to\*.cue

    Of course, the “\path\to\” bits represent your respective paths for streamripper and the path you’d like to use for the mp3 file. And, servername.net is the server which you extracted from the .m3u file earlier. The port “12200” is just hypothetical — use whichever port was listed in the m3u file (which may be a different number or there may be none at all). And, you'll also need to specify the time length to record (in seconds) which is the “7200” above.

    So, what’s the “del” statement in there? Well, “.cue” files are a meta-file which are created through the mp3 extraction process; but, they’re useless for our purposes. So, deleting them just makes for less hard drive clutter.

    And, if you’re curious, here’s what each of those parameters do:

    • -a: this records the mp3 to a single file. Without this, Streamripper may try to rip the show into several separate files (which could be useful if you’re ripping an Internet radio station, but not really for public radio).

    • -s: this prevents Steamripper from creating a directory for each stream. I find it easier to just sort the files on my own afterwards.
    • -l: as mentioned above, this specified the length of time to record, in seconds.

    • -o: this tells Streamripper to overwrite tracks in the destination directory. I find this handy since I only really want the most current episode of (say) Morning Edition at any given time.

  7. That’s it for the batch file, so just save it with a “.bat” filename, such as morning-edition.bat or marketplace.bat.

  8. Just two more steps left: scheduling (this one) and id3 tags (the next one). Now that you have a batch file set up, it’s just a matter of telling your OS to run that file at the program’s starting time. To do that, go to Control Panel -> Scheduled Tasks and choose Add Scheduled Task. You can probably figure out the scheduling from here — you choose the batch file which you just created and set it to run at the program’s start time.

  9. At this point, you’re all set to record mp3 streams from NPR but they’ll probably have weak (if any) id3 information in there (which is the data inside an mp3 file that describes the artist name and track number, among other things).

    So, after each time a file is downloaded (or at least just before you sync those files with your iPod), you’ll need to add its id3 information. For that, I prefer to use Mp3tag (which is free). And, here’s the naming scheme which I like to use:

    • Title: the show’s name, such as “Morning Edition”

    • Artist: “NPR”, which ensures that all my public radio mp3s are grouped together

    • Album: the date, in YYYY-MM-DD format. This way, after selecting the Genre and then Artist on my iPod, I can select a date and see all shows from that day.

    • Track: I generally choose a number the chronological sequence of the shows for that day, so that they’ll play back in the same order in my iPod. So, Morning Edition might be “01” followed by Day to Day (“02”) and Marketplace (“03”).

    • Genre: I’ve set all of my NPR recordings to “Public Radio” for the genre.

So, that’s how you can set up Streamripper to record MP3s from NPR. I know it may look like a lot of steps, but it's not too hard once you get into it. And, if it doesn’t record what you’re expecting, you may find it helpful to try setting your recording time to five seconds or so (temporarily), and then running the batch file manually; that way, you can see whether it’s recording the right station or even whether it’s recording at all. Or, if you get stuck, leave a comment and I’ll try to help out.

32 thoughts on “Ripping NPR to MP3 for an iPod

  1. Thanks a lot for the tutorial. I recently started at a job where streaming NPR over the web is a no-no, so I’ve been missing out lately.
    I would like to point out that there is a site that you can buy NPR shows online in mp3 format.
    Check out http://www.audible.com/npr/. I’m not completely sure how it works, but it looks like you have to purchase on a per-show basis (like a month of All Things Considered and/or a month of Talk of the Nation etc.).

  2. I’m glad you found this useful, Joe. And, I have seen Audible.com and while I’d gladly pay a few bucks a month to get NPR delivered automatically to my iPod, their prices are almost outrageous — $13/month for one show?

  3. Alex,

    This is a great tutorial. Thanks!

    However, I noticed that even though I set “-l 7200” for a 2h recording, and streamripper seems to be running for the full length, I get a much shorter mp3 file (sometimes ~30min). Any ideas regarding this?

    I also experimented with “MP3-tag studio”, which allows me to tag the file from a batch script. This was a limitation with mp3tag.

  4. If you’re into time shifting radio, try Replay Radio.

    Replay Radio lets you record ANY Radio station broadcast over the Web (including lots of Public Radio) as an MP3 file, and then copy it to your iPod or other MP3 player. It will even burn CDs automatically.

    Replay Radio comes with a database of over 900 shows and 1200 stations, and you can easily add your own.

    One more cool feature: with the optional Replay Player, when you listen on your PC you can easily skip over the ads. (If you use an iPod, just hold down the Next Track button to fast forward.)

    Check it out! A free trial is available from here:

    http://www.replay-radio.com

    Enjoy!

  5. There is a kind of “tivo-for-radio.” I doubt that it would be quite as elegant as ripping their mp3 streams and batch-renaming, but the hardware solution is called the Radio Shark.
    I’d been thinking about buying for my Pop – he hates to miss Fresh Air. Unfortunately, it is still limited by the distance of FM/AM broadcasting, so he, at least, is limited to the sub-standard Pittsburgh NPR affiliate. (which doesn’t syndicate the Diane Ream Show!!@!@)

  6. Alex,

    This is a great tutorial. I found it five minutes before All Things Considered was scheduled to begin and had it up and ripping by the start of the show. Thank you!

  7. what bugs me is how so many are still using streams when one simple mp3 can do it all. I can listen now and forward or download. Stream ripping is fine and i do it too but a simple mp3 download is better. i hope more folks catch on like http://www.loe.org did. i hope more will make the switch from streaming audio to mp3. MP3 is way way better.

  8. I guess I am not sure if it is a mp3 file or not. It shows up in the search of an mp3 files, but instead of m3u it says it is in file format pls.

    Anyway, I found an mp3 feed, and I get the ripping to begin, but now I can’t get it to save a file (at least, I can’t find the file).

    I thought it was because I didn’t but the -a after the http code in the first line, but after that I still can’t find the output file.

    It says it is ripping, though it doesn’t stop after the number of seconds I set for it (30 at this moment to try).

  9. Oops, OK. I see now I was using 3 lines instead of 2. So I guess it had no instructions about when to stop and create a file.

    Now it seems to work. Great! Thanks.

  10. […] E.J. Junior Senior Junior High NPR has a weekly game show called “Wait Wait Don’t Tell Me” which they describe as “The Oddly Informative News Quiz” (which is a fairly apt description). There’re various panelists — P.J. O’Rourke, Paula Poundstone, Mo Rocca, and others — and either the host asks them questions or listeners call in and the panelists ask them questions. It’s actually a lot of fun & mdash; a lot lighter than the usual NPR fare — and I’ve recently taken to ripping the episodes to mp3 to timeshift them. […]

  11. Well, I use XP. And the streamripper utility will not open from a bat file. (It opens for half a second then closes). However, if I manually open the command prompt, then, in a DOS environment, go to the streamripper.exe file, it works like a charm. Trouble is, I can’t schedule anything this way. Moreover, I can’t remember my old DOS commands.

    Can someone tell me what commands to use to get streamripper to open and work in Windows XP, without me having to manually open it from a command prompt?

  12. Thanks very much for taking the time to write this out. A few comments:

    1. The -o switch in streamripper takes an argument; it should say “-o always” if you want to always overwrite.

    2. I haven’t been able to get the -s switch in Streamripper to work. No matter whether I include it or not, I get a separate directory for each stream. Strange …

    2. I wanted to add the date to the end of the name of the created file, so I looked around a little and found this:

    http://www.xs4all.nl/~chi/utilities/rents.html
    If you download this little (60K) utility and put this line at the end of your batch file:

    c:\path\to\rents.exe d:\path\to\name-of-show.mp3 /d=yymmdd
    your show is automatically renamed name-of-show yymmdd.mp3. Great for archiving multiple instances of the same program.

  13. Andy: I had that problem, too. It seems the command-line switches have changed for later versions of streamripper. On my website, I made some modifications to the batch file, using a specific version of streamripper, and also added support for automatic id3v2 tagging.

    Convert mp3 stream to podcast

  14. I had the same problem with -l as Rich did above. I set it to run for 7200 seconds and it recorded for about 7 minutes. Any clues?

  15. Hi. somebody was wanting the “scheduled tasks” entry for windows XP to run streamripper automatically.

    the following example works for me, although first you specify the path to the ‘cmd.exe’ program alone (as the commond to run in the ‘add scheduled task’ wizard), then later edit the task’s ‘Run:’ line to contain the following (all on one line — and notice the double quote chars after the /k and at the end of the line). this will leave a cmd window open so you can see if there were any problems with the stream.

    C:\WINDOWS\system32\cmd.exe /k “C:\stream\streamripper http://wxpnsc96.streamguys.com:80/ -l 7200 -d /stream/echoes -a %d”

  16. Alex or others,

    I think I am almost there in getting this script to work, but I am one problem: the streaming starts when I want it to, but it doesn’t seem to end–even though I have indicated the time in secs in the script. Please help. vianneyk@yahoo.com

  17. I’m tryng to rip “This American Life” using the command line below using a length of 10 just to test, but it doesn’t write out a file. I’m using XP. Any idea what’s wrong?

    C:\Program Files\Streamripper\streamripper-win32-1.61.24>streamripper.exe http:/
    /wbez-tal.streamguys.us/content/7.mp3 -a C:\temp\7.mp3 -s -l 10

  18. Hi All,
    The Streamer is not stoping after ripping the stream. Its sort of in a loop. Basically after downloading the file its downloading again and again without Stop.

    At the bottom there are two links I’m interested in from All India Radio. Another thing I notice is that these (links) are already contains complete Mp3 which I can download the whole MP3 by right click and so I guess there may not be of streamer at all.
    Can you please fix this BAT for me.
    C:\tmp\pod\streamripper-win32-1.61.7\streamripper.exe http://www.newsonair.com/listennews/HindiNews.mp3 -a C:\tmp\pod\podmp3\name-of-the-show.mp3 -s -l 3000 -o
    del C:\tmp\pod\podmp3*.cue

    [link1—>www.newsonair.com](http://www.newsonair.com/listennews/HindiNews.mp3)
    [link2—>www.newsonair.com](http://www.newsonair.com/listen_news/English_News.mp3)

  19. Thank you! Worked with just a little effort on my part. Thanks also to Andy (12-1-2005): The “renTS” program you recommended works great.

    Here is a sample batch file for anyone just getting started (what appears as the first two lines is actually a single line of the batch file, it’s just long):
    ————————-
    c:\NPR_Streams\streamripper\streamripper.exe http://wksu1.streamguys.com:8020/ -a c:\NPR_Streams\Programs\CarTalk.mp3 -s -l 3700 -o always -d c:\NPR_Streams\temp\CarTalk\

    del c:\NPR_Streams\Programs\*.cue

    del c:\NPR_Streams\temp\CarTalk\*.* /s /q

    c:\npr_streams\rents\rents.exe /f=c:\NPR_Streams\Programs\CarTalk.mp3 /d=yyyy-mm-dd

    ————————-

  20. Here is a way to add a date to the end of your file using just the batch program.

    Put this bit of code at the very top of your batch file:

    set year=%date:~-4,10%
    set day=%date:~-10,-8%
    set month=%date:~-7,-5%
    set datefile=%year%-%month%-%day%

    Then, when you get to the portion of the batch file where you enter the path and name of the file you are creating just add %datefile% before the file extension.

    Example: D:\Ipod\NPR\AllThingsConsidered_%datefile%.mp3

    Then your file will be named like AllThingsConsidered_10052009.mp3 whenever it records.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.