How do I get a list of people watching a streamer and people who are active in that streamers chat?
It’s impossible to get a list of people viewing the stream. Only Twitch has that data, and game developers have a limited set of that data through the VHS/Drops system but even then the viewer has to opt in to it and they only get data from streams playing their game.
As for people in chat, you if you do a search for the undocumented chatters endpoint you’ll find how to do that, but as an undocumented endpoint you will get no support for it and it will likely be turned off, potentially without prior warning, one day.
If I have another twitch user username, can I check if they are watching that streamer?
No, it’s impossible for you to know who is watching a stream, it would be an invasion of privacy.
Can I check if someone has chatted during a specific stream?
Or is all the information I can get from a stream the amount of viewers and game info?
If you want to know if someone has spoken in chat you’d have to connect to chat and keep track of every message spoken in that channel (with the channel owners permission, of course).
Was this possible in older API versions / at any point in time?
It’s never been possible.
Seems the royal streamers are able to do it so is it possible at all?
Like I’ve told you. If you want to know if someone has spoken in chat you have to connect to chat and read the messages as they happen. There are NO documented endpoint to retrieve who has spoken in chat, or historical chat data.
As for viewers there is no way to know who specifically is viewing a stream. It is possible to collect some mixture of metrics based on extension activity, presence in chat, chat activity, etc… but none of that has certainty to it.
Many 3rd party services that do analytics or try to track viewership data do so using various metrics but there will always be a degree of inaccuracy because no 3rd party has access to accurate viewer data, so they collect metrics from many sources themselves, and the exact data used is often not disclosed.
Royal logs all the chats of the Royal Streamers in real time.
As dist mentioned:
Royal knows has a nice list of known streamers to look at.
Through the irc commands?
I find that the unofficial endpoint of chatters is VERY close to the actual viewers watching the stream, often off by less than 1%. This is good enough for most people.
It varies depending on which channels you’re looking at. The Twitch average deviation between viewers and users in chat is usually much closer to 20%, with some as high as 50% and rarely below 5% difference.
This difference also varies greatly depending on the type of stream happening.
Those figures are just a very rough overview based on doing ~6 years of Twitch analytics myself.
tl;dr don’t assume the chatters endpoint is anywhere close to actual viewers.