Online Radio Link Scraping For MPD How To

By | January 7, 2015
  • Facebook
  • Twitter
  • Delicious
  • LinkedIn
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS

It’s not a secret that I have a Raspberry Pi. I’ve published a couple of articles a while back explaining how to change DNS servers on XBMC so that you can watch region restricted media streaming services and I also shared another fix that can help you solve problems with Hulu streaming specifically. Raspberry Pi is no longer used as a media center, now it’s an online radio streaming box. Now I wanna show you how to pluck radio stream URLs from radio stations like Radio Tunes, Digitally Imported, Radionomy and any other online radio streaming service where URLs suitable for MPD (console based linux music player) can’t be found easily.

How to find direct streaming URLs of online radio stations for MPD

What I’m gonna talk about here might not work every time, it’s a bit of a hit and miss, so don’t give up right away. MPD is a console based media player that I run on my Debian powered Raspberry Pi.

online radio mpd raspberry pi playing

Here’s MPD in action. I’m connected to Raspberry from my desktop computer via SSH. From here I’m adding stations, cleaning up the playlist, switch between the radio stations already on the playlist and do all the other maintenance tasks. Trick with MPD is that not every radio station URL doesn’t just work? For example, head over to Soma.fm and try to add links that they give to their M3U streams. It won’t work. Same thing goes for Radionomy and lots of other online radio station streams. Few of them give the URL structure that MPD requires, but here’s a neat trick to help you do just that.

online radio stream URL mpd radio tunes

Also have a look at: Free Winamp/Windows Media Player Online Radio Playlist – RadioCast

So here’s a step by step guide of what needs to be done:

  • 1. Open radio station – find the radio station that you would like to listen to, and make sure to stop it if it starts playing.
  • 2. Run code inspector – in Firefox this is achieved by right clicking and selecting Inspect Element.
  • 3. Switch to the Network tab – we need the network tab to keep track of where requests are sent to and received from after performing actions on the website (when you click something).
  • 4. Press the Play button now – play the radio station now by pressing on the play button. Lines will be added to the Network tab of the Inspector down below.
  • 5. Find the stream URL – now we’ve come to the tricky part. Here you need to go through the list of URLs down below and find one where either “streaming”, “aacplus”, “pub” or something similar to that is mentioned. in this case the URL is:
    http://pub1.radiotunes.com/radiotunes_smoothjazz_aacplus?type=.flv
  • 6. Clean up the URL – another thing that’s hit and miss is if the URL will work. I tried to add this URL like it is, but it didn’t work. I assumed that the problem is the ?type=.flv at the end of the link. After a bit experimentation and adding the wrong URLs everything worked.

Using Windows 8? Checkout Free Online Radio Player For Windows 8 With Recording – FM Live

Same things goes for Digitally Imported:
online radio URL digitally imported scrape

And also the same thing goes for Radionomy:
radionomy raspberry pi scrape url mpd mpc online streaming

How to add scraped online radio URLs into MPD

Let’s not drag this more than it’s necessary, the command that we’re looking for is this:

mpc add http://pub1.radiotunes.com/radiotunes_smoothjazz_aacplus

Command above will add the previously scraped URL from Radio Tunes. And here it is the radio is now playing.

raspberry pi mpd online radio streaming radiotunes radio tunes

Final thoughts

Important thing to take from the very enlightening tutorial posted above is to not give up if the URL isn’t working. It might needs to be adjusted a bit, something removed from it, you might find lots of URLs experiment with them all. Also don’t forget to check if the website is already offering direct stream URLs. Somafm.com does for example.

Leave a Reply