maanantai 1. kesäkuuta 2009

How winamp retrieves radiostation listing from shoutcast

So how does winamp do what it does? Maybe shoutcast would have provided API for retrieving stationlisting, but I find it always fun when I get to play with security-tools. I figured by sniffing the traffic winamp generates I might be able to find out what to do. I used wireshark for this and this is what I got:

Everytime you click a genre or do a query by string winamp sends following stuff:

Search by genre example:

Address: yp.shoutcast.com
Port: 80

GET /sbin/newxml.phtml?genre=Jazz HTTP/1.0
Host:yp.shoutcast.com
User-Agent: Winamp/5.55

What we get as a response is a XML containing stationlisting:

<?xml version="1.0" encoding="UTF-8"?>
<stationlist>
<tunein base="/sbin/tunein-station.pls"></tunein>

<station
name="Absolutely Smooth Jazz - S K Y . F M - the world's smoothest jazz 24 hours a day"
mt="audio/mpeg"
id="948"
br="96"
genre="Soft Smooth Jazz"
ct="Chuck Loeb - Water Runs Dry"
lc="3253">
... bunch of stations ...
</stationlist>


Now the previous station can be listened with following address (note the id pasted in the end):

http://yp.shoutcast.com/sbin/tunein-station.pls?id=948

After googling some time I was able to get a list of all possible genres which are all ID3 genres + some additional genres by shoutcast.


Additional information

Tv-station listing is fetched a bit differently. Winamp fetches a list of all channels only once and searching is done locally.

Query:

Address: yp.shoutcast.com
Port: 80

GET /sbin/newtvlister.phtml?alltv=1 HTTP/1.0

Again we get a XML which is very similiar to previous one.


Next thing I am going to do is writing a hello world extension for banshee. And after that I am going to figure out how to compile the existing Internet radio extension so that I wouldn't have to compile the whole banshee project aswell. Next post probably on wednesday.

Ei kommentteja:

Lähetä kommentti