Fetching icecast metadata file

旧巷老猫 提交于 2020-03-23 14:15:48

问题


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

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

回答1:


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.

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.

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.



来源:https://stackoverflow.com/questions/57341271/fetching-icecast-metadata-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!