Listen to iheartradio without Flash

UPDATE:  http://pyther.net/blog/index.php/2010/08/iheartradio-command-line-mplayer/

If you have ever listened to any Clear Channel FM radio station then I am sure you have heard the ads to listen to the station online through iheartradio. The only problem is that iheartradio is a bulky and slow flash application. On a powerful desktop that isn’t a huge issue, but with my N900 (600mhz cpu, 256MB Ram) it takes over 5 minutes to start streaming the radio station. Of course, iheartradio has an application for the iPod and Blackberry, but no app for the N900.

I went on a quest to figure out how to listen to iheartradio without the bulky flash application and this is what I found.

Step 1:

The url of the a stations stream is can be found in a XML file, at URL “http://p2.STATION_NAME.ccomrcdn.com/player/player_dispatcher.html?section=radio&action=listen_live”

If I want to listen to The Fox (call letters: WTFX-FM), the URL of the XML would be “http://p2.wtfx-fm.ccomrcdn.com/player/player_dispatcher.html?section=radio&action=listen_live”

Open up the url in a web browser and grab the rtmp url which is between the <stream> tags. rtmp://cp21366.live.edgefcs.net/live/Lou_KY_WTFX-FM_OR@s7696?auth=daEcEbgdNb4a3bdcKdYcrcgcGara0c1c3cZ-bmC7wi-4q-LM3Y9_7nqEDps4CCulBtyp&aifp=1234&CHANNELID=981&CPROG=_&MARKET=LOUISVILLE-KY&REQUESTOR=WTFX-FM&SERVER_NAME=p2.wtfx-fm.ccomrcdn.com&SITE_ID=2038&STATION_ID=WTFX-FM&MNM=2&TYPEOFPLAY=0

Step 2:

Download and Install rtmpdump and mplayer

  • Use your distro’s repositories
  • rtmpdump is in AUR (archlinux)

Step 3:

Lastly open up the terminal and enter the following command: rtmpdump -r $RTMPURL -v | mplayer -

-r tells rtmpdump the url of the stream

-v tells rtmpdump that the stream is a live stream

The | (pipe) directs stdin to mplayer and the – after mplayer tells mplayer to read data from stdin

Example: rtmpdump -r "rtmp://cp21366.live.edgefcs.net/live/Lou_KY_WTFX-FM_OR@s7696?auth=daEcEbgdNb4a3bdcKdYcrcgcGara0c1c3cZ-bmC7wi-4q-LM3Y9_7nqEDps4CCulBtyp&aifp=1234&CHANNELID=981&CPROG=_&MARKET=LOUISVILLE-KY&REQUESTOR=WTFX-FM&SERVER_NAME=p2.wtfx-fm.ccomrcdn.com&SITE_ID=2038&STATION_ID=WTFX-FM&MNM=2&TYPEOFPLAY=0" -v | mplayer -

Things to watch out for:

  • The RTMP url may change/expire. I have not been able to confirm this yet, but if the RTMP url changes you will simply need to open the url of the xml file (step 1) and copy the new rtmp url

Sources:

Maybe when I get some more time and become more ambitious I will write a small python wrapper that will extract the url from the xml file and start the stream.

2 thoughts on “Listen to iheartradio without Flash

  1. M

    Awesome! I just spent half my evening trying to figure this out before I wised up and searched for it. I’m trying to play audio from the command line and this is EXACTLY what I needed.

    Thanks for posting this.

  2. pswitt

    This can be crammed into a one liner like this:

    mplayer -novideo `wget -q -O- “http://p2.WHTZ-FM.ccomrcdn.com/player/player_dispatcher.html?section=radio&action=listen_live” | grep -o “rtmp\://[^\"]*”`

    (with WHTZ-FM replaced with any station id)

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>