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.
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.
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:
- 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
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.
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.