从http直播流中解析元数据
我想从通过 HTTP 传输的网络广播中提取信息字符串。我所说的信息字符串是指关于当前播放的歌曲、乐队名称等的简短说明。
最好我想用 python 来完成。到目前为止,我已经尝试打开一个套接字,但从那里我得到了一堆我无法解析的二进制数据......
感谢您的任何提示
I'd like to extract the info string from an internet radio streamed over HTTP. By info string I mean the short note about the currently played song, band name etc.
Preferably I'd like to do it in python. So far I've tried opening a socket but from there I got a bunch of binary data that I could not parse...
thanks for any hints
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
听起来您可能需要一些垫脚石项目才能为此做好准备。没有理由为 HTTP 使用低级套接字库。有很多很棒的工具,包括命令行实用程序和 python 标准库模块(例如 urlopen2),可以为您处理低级 TCP 和 HTTP 细节。
您知道数据所在的 URL 吗?您是否在命令行上尝试过一些简单的操作,例如使用 cURL 来获取原始 HTML,然后使用 grep 等基本工具来查找您需要的信息?我假设这里元数据实际上以 HTML 形式提供,而不是由无线电流媒体直接读取的二进制格式(大概是在闪存中?)。
很难向您提供任何具体信息,因为您的问题不包含有关数据源的任何技术详细信息。
Sounds like you might need some stepping stone projects before you're ready for this. There's no reason to use a low-level socket library for HTTP. There are great tools both command line utilities and python standard library modules like urlopen2 that can handle the low level TCP and HTTP specifics for you.
Do you know the URL where you data resides? Have you tried something simple on the command line like using cURL to grab the raw HTML and then some basic tools like grep to hunt down the info you need? I assume here the metadata is actually available as HTML as opposed to being in a binary format read directly by the radio streamer (which presumably is in flash perhaps?).
Hard to give you any specifics because your question doesn't include any technical details about your data source.