获取 icecast 元数据文件 [英] Fetching icecast metadata file

查看:68
本文介绍了获取 icecast 元数据文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 jquery XMLHttpRequest 获取 icecast 元数据.有 status.xsl 和 status-json.xsl url.如果我只有 icecast 电台网址,我怎么知道我什么时候使用每一个?

I am getting icecast metadata using jquery XMLHttpRequest. There is status.xsl and status-json.xsl url. How do I know when do I use each one, if I only have icecast radio url?

例如这台收音机可以同时使用它们:

For example this radio works with both of them:

http://149.56.195.94:8416/status.xsl
http://149.56.195.94:8416/status-json.xsl

此收音机使用 status-json.xsl 引发错误

This radio throws an error using status-json.xsl

http://stream.radios-arra.fr:8000/status.xsl
http://stream.radios-arra.fr:8000/status-json.xsl - ERROR: Could not parse XSLT file

推荐答案

如果您不是 Icecast 服务器的操作员/管理员,则无法确定任何查询是否有效,因为可以单独禁用所有 XSLT 端点.

If you are not the operator/administrator of the Icecast server, then it's impossible to know for sure if any query will work, as it's possible to individually disable all of the XSLT endpoints.

从客户端开发人员的角度来看,最好的办法是探测服务器并理想地缓存结果.服务器行为只会在更新到更新版本或管理员更改配置时发生变化,这两种情况都不常见.

From a client developer perspective, your best bet is to probe the server and ideally cache the result. Server behavior will only change if it gets updated to a newer version or the administrator changes configuration, both of which is not a common occurrence.

如果您探测服务器,请注意 JSON 端点在 2.4.1 以下的 Icecast 版本上是不可靠的!只有 2.4.1 及更高版本才能提供可靠且有效的 JSON.

If you probe the server, please note that the JSON endpoint is known to be unreliable on Icecast versions below 2.4.1! Only version 2.4.1 and above will deliver reliable and valid JSON.

另请注意,status.xsl 不是 API,并且不同版本的内容变化很大!在野外也经常观察到输出的个人定制".因此,如果您选择抓取此内容,请使您的代码尽可能健壮,并为意外内容做好准备.

Please also note that status.xsl is not an API and content varies wildly between versions! Also individual "customizations" of output have been frequently observed in the wild. So if you chose to scrape this, make your code as robust as possible and prepare for unexpected content.

这篇关于获取 icecast 元数据文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆