Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get the raw stream URL of an iheartradio station

I am trying to make a discord bot to stream the iheart80s at 103.7 radio station, and so far I can not find a direct stream URL to give my discord bot.

I have tried to get the JSON via Python but that just returns http.client.BadStatusLine: ICY 200 OK

I am using discord.js. And here is the function I am trying to feed the stream URL into:

function(CmdArg,CmdMsg){
  const voiceChannel = CmdMsg.member.voiceChannel;
  voiceChannel.join().then(connection => resolve(connection)).catch(err =>reject(err));
  const stream = () => {
           return request.get({
               uri: CmdArg,
               followAllRedirects: true,
               encoding: null
           });
       }


    console.log(stream);
    CmdMsg.guild.voiceConnection.playStream(stream, { passes: token.passes    });
}
like image 601
IncrementTimesTwo Avatar asked Oct 26 '25 14:10

IncrementTimesTwo


2 Answers

It has changed yet Again, none of the wireshark solutions, or searching for certain texts in the inspect tab of chrome/firefox helped, but I figured it out...

The example I'll be using is: I heart Mix 90.1 Toluca https://www.iheart.com/live/mix-901-toluca-6566/

  1. Click on the Share icon, it's the one to the right of the 'connect' button.
  2. Look for the Embed Widget section.
  3. Then copy from the end of src=". Example: The whole text is

<iframe allow="autoplay" width="100%" height="200" src="https://www.iheart.com/live/mix-901-toluca-6566/?embed=true" frameborder="0"></iframe>

and I will copy

https://www.iheart.com/live/mix-901-toluca-6566/?embed=true
  1. Ok, great. Now we have much less html and urls to work with. Now copy that url and paste it in your web browser (you can now close the previous radio webpage). Rick click the play button, select Inspect.
  2. Now, using Ctrl+F (press only ctrl and F), look for stream. You should get several results, but they will be all on the same text line, so don't worry.
  3. Now double click in that load of JSON data, should start with something like {"initialPropos" : {....., now copy all that text and paste in a text editor which will let you search through text (e.g. vim, notepad, MS Word)
  4. Now, open the text editor with the pasted text. Now look for streams. The first result should start with something like: ,"streams":{"hls...
  5. Great! Now you may copy the stream of your liking, some may not be available, but in this example, the following stream types are available:
{
"hls_stream":"http://playerservices.streamtheworld.com/api/livestream-redirect/XHENOFMAAC.m3u8",

"pls_stream":"http://playerservices.streamtheworld.com/pls/XHENOFMAAC.pls",

"secure_hls_stream":"https://playerservices.streamtheworld.com/api/livestream-redirect/XHENOFMAAC.m3u8",

"secure_pls_stream":"https://playerservices.streamtheworld.com/pls/XHENOFMAAC.pls"}
  1. Now, you may choose the stream of your liking and open it with your favorite audio/video player. E.g. (be sure to put it in double quotes so it won't get manipulated by your shell or smth) mpv "http://playerservices.streamtheworld.com/api/livestream-redirect/XHENOFMAAC.m3u8"

  2. The End! Now you should be good to go! If I was not at all clear, please tell me so. The only reason I've created a stack overflow account is to post this and help others know how to do this, so please let me know if this is not working!!

Cheers.

like image 116
TrevCan Avatar answered Oct 28 '25 03:10

TrevCan


I was able to find the iheart url by doing this... Go to desired radio station web site. Click on listen/play. Right click page then view page source. Find/search for..."icy" The first instance of "icy"should be here.. "shoutcast_stream":"http:// (various letters and numbers). playlists.ihrhls.com/(4 numbers) icy" I copy and pasted the http address into winamp and it worked.

http://c10icyelb.prod.playlists.ihrhls.com/4342_icy

like image 30
Uber fenastray Avatar answered Oct 28 '25 04:10

Uber fenastray