[Icecast-dev] Improvement Request
Geoff Shang
geoff at QuiteLikely.com
Tue Aug 31 15:40:49 UTC 2021
On Tue, 31 Aug 2021, Tobias Tromm wrote:
> - Any chance to implement some option where I can get numbers of listeners from specific stream and show on another website?
There's a few ways you can achieve this:
Disclaimer: It's been years since I've worked with any of this and some
things might have changed.
1. You can access the raw XML data and pull out what you need. Last time
I did this, this required the client to request with the Icecast admin
username and password, which may be undesirable.
You can reach these stats at http://<server>:<port>/admin/stats.xml
2. You can create an XSL page to serve you up the data that you want in
the format that you want it. I've used this a number of times, sometimes
to mimic the output of other servers for compatibility with existing
scripts, and other times to give me just what I want - such as the title
of the stream to include in a tweet.
You can look at the templates that ship with Icecast as examples. The
logic is a bit funky but it's quite powerful.
3. You could use one of the existing XSL pages supplied with Icecast and
scrape it from there. This is not recommended, as most of them present
user interfaces designed for humans to interact with and could be subject
to change. But there is a sheet which presents the info in JSON format
which could be useful (introduced in Icecast 2.4).
HTH,
Geoff.
More information about the Icecast-dev
mailing list