Streaming radio has been a common use of the Internet for many years. At one point, almost all audio streaming had only limited commercial implications. As the use of advertising has become more important as a source of revenue for radio stations, audio streams on the Internet have become entwined with players, typically flash-based, that serve advertising, collect user data, and provide other services. One side effect of this is that it can may it very difficult to debug the set of network connections being used. If, like me, you run a tight firewall, you need to have a sense of where data is coming from, and going, to allow the ports to be opened and closed.
Thus, I needed to figure out how audio streams were being sent from an audio station I wanted to listen to. The audio stream I wanted was being provided from streamtheworld.com and the actual transactions are handled by a rather complex mess of javascript and flash objects. Here's how to find the streams using Wireshark, a fancy network analysis tool.
There are two steps which I elaborate below:
1) Find the call sign for the station. With luck, you can guess this. This will often (but not always) be related to the station's familiar name. For example, for the station Q107 in Toronto the nationally registered call sign is CILQ and the callsign for streamtheworld.com is CILQFM; sensible. On the other hand, the streamtheworld identifier for CBMT CBC Radio One Montreal is CBC_R1_N_MTL_H.
2) Find the playlist (.pls file) or stream ID.
Call sign identification
Firstly, note that Wireshark is a very powerful open-source network analyzer (formerly known as ethereal). It can be downloaded free for most platforms and runs using the X-windows windowing system (that works on Linux [default], Mac [standard but optional] and [with some effort] Windows).
Turn on packet capture in Wireshark and then using your browser on the same computer load the page with the stream you want.
Enter (i.e. specify) a filter as follows (see the picture):
tcp contains "callsign"
that will be used to "listen in" on the data exchange.
This should return an HTTP GET statement of the probable form:
GET /xmlconfig.php?view=xml&callsign=CILQFM&streamid=86
and an associated full URI of the form:
http://playerwebadmin.streamtheworld.com/xmlconfig.php...
It's the callsign argument you want (in this case, CILQFM, for example).
Play list via wireshark
At this point, you can just go to
http://provisioning.streamtheworld.com/pls/CILQFMaac.pls
to get the playlist, which can be used to see what's really happening.
Note the example use of the CILQFM call sign in the URL.
Playing the stream without needing wireshark
Once you have the play list, you can directly inspect it to determine the ports in use. You can also drag it into Apple's iTunes.
If you know the callsign and just want to play the live stream, or see how this can be done programmatically, then there is a nice python script available from Dan McGee at http://www.toofishes.net/blog/streamtheworld-streams-command-line/.
[ Originally posted 2012/10/15, with minor updates, Oct 2017, 2020. Apparently this still works. ]