如何从在线流媒体广播电台获取流媒体网址

时间:2014-01-16 09:40:23

标签: javascript android html stream

我被要求为某个广播电台制作非官方的在线流媒体Android应用程序 我已经体验过在某些mp3或任何流中使用android进行流媒体播放 但我不知道stream url中要提供的mediaPlayer.setDataSource(url)

有没有办法从exiicial流媒体页面获取流网址为ex。 this radio stream

5 个答案:

答案 0 :(得分:15)

没那么难,

如果您查看页面源代码,您会看到它用于通过shoutcast传输音频。

这是流网址

“StreamUrl”:“http://stream.radiotime.com/listen.stream?streamIds=3244651&rti=c051HQVbfRc4FEMbKg5RRVMzRU9KUBw%2fVBZHS0dPF1VIExNzJz0CGQtRcX8OS0o0CUkYRFJDDW8LEVRxGAEOEAcQXko%2bGgwSBBZrV1pQZgQZZxkWCA4L%7e%7e%7e”,

返回类似的JSON:

{
    "Streams": [
        {
            "StreamId": 3244651,
            "Reliability": 92,
            "Bandwidth": 64,
            "HasPlaylist": false,
            "MediaType": "MP3",
            "Url": "http://mp3hdfm32.hala.jo:8132",
            "Type": "Live"
        }
    ]
}

我相信这是你需要的网址: http://mp3hdfm32.hala.jo:8132

this is the station WebSite

答案 1 :(得分:4)

Shahar的回答非常有帮助,但我发现自己做这件事非常繁琐,所以我做了一个漂亮的小Python程序:

import re
import urllib2
import string
url1 = raw_input("Please enter a URL from Tunein Radio: ");
open_file = urllib2.urlopen(url1);
raw_file = open_file.read();
API_key = re.findall(r"StreamUrl\":\"(.*?),",raw_file);
#print API_key;
#print "The API key is: " + API_key[0];
use_key = urllib2.urlopen(str(API_key[0]));
key_content = use_key.read();
raw_stream_url = re.findall(r"Url\": \"(.*?)\"",key_content);
bandwidth = re.findall(r"Bandwidth\":(.*?),", key_content);
reliability = re.findall(r"lity\":(.*?),", key_content);
isPlaylist = re.findall(r"HasPlaylist\":(.*?),",key_content);
codec = re.findall(r"MediaType\": \"(.*?)\",", key_content);
tipe = re.findall(r"Type\": \"(.*?)\"", key_content);
total = 0
for element in raw_stream_url:
    total = total + 1
i = 0
print "I found " + str(total) + " streams.";
for element in raw_stream_url:
    print "Stream #" + str(i + 1);
    print "Stream stats:";
    print "Bandwidth: " + str(bandwidth[i]) + " kilobytes per second."
    print "Reliability: " + str(reliability[i]) + "%"
    print "HasPlaylist: " + str(isPlaylist[i]) + "."
    print "Stream codec: " + str(codec[i]) + "."
    print "This audio stream is " + tipe[i].lower() + "."
    print "Pure streaming URL: " + str(raw_stream_url[i]) + ".";
    i = i + 1
raw_input("Press enter to close TMUS.")

基本上Shahar的解决方案是自动化的。

答案 2 :(得分:4)

编辑了ZygD对python 3.x的回答:

var f = new StreamBlockCipher(new CfbBlockCipher(new AesEngine(), 128));

答案 3 :(得分:1)

当您转到流网址时,您会收到一个文件。将此文件提供给解析器以从中提取内容。该文件(通常)是纯文本,包含要播放的网址。

答案 4 :(得分:1)

提供的答案对我不起作用。我要添加另一个答案,因为这是我在搜索广播流网址时最终到达的地方。

Radio Browser是一个可搜索的网站,其中包含世界各地广播电台的流URL:

http://www.radio-browser.info/

搜索FIPPinguin RadioRadio Paradise之类的电台,然后单击“保存”按钮,下载可在无线电播放器(节奏盒)中打开的PLS文件,或者在文本编辑器中打开文件,然后复制URL以添加到Goodvibes中。

相关问题