Thursday, February 26, 2009

KFI Internet Stream URL

Update (2010-07-22): Recently KABC also changed their streaming method. Neither station can be played in a dedicated player now.




Update (long ago): About a week ago, Clear Channel updated their internet stream again, this time to a flash based thing. Unfortunately, in this update they no longer serve the XML expected by this script to the Sonos user-agent.

If anyone has a way to grab the stream URLs from the new player, please leave a comment.




If you've been trying to play the KFI radio stream in an external media player like totem, mplayer, or VLC, you've no doubt suffered annoyance at the number of hoops you have to jump through to acquire it. Further, the url needs to be refreshed every few hours to get the new authorization code.

Luckily, there's a solution. If you set your User-Agent to "Sonos" when you go to the KFI player it will send an XML file containing the stream URL instead of redirecting to the new browser player.

You can change your User-Agent string in Firefox with User Agent Switcher, or you can fetch the url with
wget -U "Sonos" http://www.kfi640.com/cc-common/ondemand/player.html
.

Once you have the file you can just copy the URL into the player of your choice.

Or you can use a Bash script that wget's the file, parses out the url with sed, and loads the results into totem.



I can't claim complete authorship of the bash script, as I found a version on a forum first, and have only subsequently made modifications to keep it working through Clear Channels streaming changes and to add a switch for another station I listen to.