如何获取 iheartradio 电台的原始流 URL

Inc*_*Two 3 javascript node.js internet-radio

我正在尝试制作一个 Discord 机器人来在 103.7 广播电台传输 iheart80s,但到目前为止我找不到直接流 URL 来给我的 Discord 机器人。

我尝试通过 Python 获取 JSON,但只返回 http.client.BadStatusLine: ICY 200 OK

我正在使用discord.js。这是我尝试将流 URL 输入到的函数:

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    });
}
Run Code Online (Sandbox Code Playgroud)

小智 6

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
Run Code Online (Sandbox Code Playgroud)
  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"}
Run Code Online (Sandbox Code Playgroud)
  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.