Python 3 - Urllib3 读取网络广播元数据

Python 3 - Urllib3 read internet radio metadata

如何读取有关使用urllib3 播放歌曲的信息?我应该使用哪个 headers?

import urllib3 
http = urllib3.PoolManager()
response = http.request("GET", "http://pool.cdn.lagardere.cz/fm-evropa2-128", headers={
        'User-Agent': 'User-Agent: VLC/2.0.5 LibVLC/2.0.5',
        'Icy-MetaData': '1',
        'Range': 'bytes=0-',
    })
print(response.data)

我试过了。但它坚持发送请求。谁能帮我?感谢您的回答。

以下代码returns 给定流的所有header 数据。不幸的是,我无法通过这种方式获得歌曲名称。

import requests

url = 'http://pool.cdn.lagardere.cz/fm-evropa2-128'

def print_url(r, *args, **kwargs):
    print(r.headers)

requests.get(url, hooks=dict(response=print_url))

输出如下:

{'icy-description': 'Evropa 2', 'Via': '1.1 s670-6.noc.rwth-aachen.de:80 (Cisco-WSA/8.8.0-085)', 'icy-genre': 'Various', 'icy-url': 'http://www.evropa2.cz', 'icy-pub': '0', 'ice-audio-info': 'ice-samplerate=44100;ice-bitrate=128;ice-channels=2', 'Date': 'Fri, 29 Jan 2016 17:24:20 GMT', 'icy-br': '128, 128', 'Content-Type': 'audio/mpeg', 'Connection': 'keep-alive', 'Transfer-Encoding': 'chunked', 'icy-name': 'Evropa 2', 'Server': 'Icecast 2.3.2', 'Cache-Control': 'no-cache'}