[Feature request] Possibility to query actual viewers of the stream

Good evening guys,

at the moment the only way to get names/ids of current viewers is to query the users currently connected to the chat.

Since we are trying to reward users for watching our streams and we don’t want them to sit around in the chat without really watching the stream, we would need such an API.

So my request for an addition to the Twitch API is an endpoint where one can request the list of current users watching the stream. This would only return the users which are logged in of course. I don’t know if there’s more data available (like the time when the user started watching), but that would be optional.

I think that more developers would agree on this request since there are several posts asking for a way to retrieve the viewer list.

Thanks in advance.

kaenganxt

2 Likes

But then people would just mute the stream and not actually watch and not participate in chat, basically the same as now I suppose. Lurkers lurk.

The lurkers like to lurk and just accrue the currency.

(I’m not disagreeing with the idea, just pointing out the hole)

You’re right on the one hand, but it’s more difficult (and less people would do it) in general, since some watchers just connect to the chat with an irc bouncer.

Personally I would prefer this information not be publicly unless it’s protected behind an additional scope on the viewers account.

With chat you can opt out of being “tracked” by only viewing popping out the video and closing chat but the same cannot be done for video since you would have to log out. Logging out is a moot point when you consider things like Turbo or subscription accounts.

3 Likes

Viewers account would make this sort of data capture real difficult. Since you’d have to auth everyone to an external site (great for currency checks).

But then true presence is a thing that needs to be protected.

@kaenganxt it’s also real difficult to see who is actually receiving the bits and bytes of a feed without constant ping back. Considering a UDP style approach to how people receive video. Chat is more ping pongy. Video itself not so much (this is probably one of the holy grails of statistic collection) continues to babble

I don’t know if the new Twitch friend system uses real stream viewer data (which would make it easy to implement) or also the chat users, but I think there are easy ways to see if the user is watching the stream (since the viewer count also displays the real viewers). There may still be ways to trick the system, but it’s definitely more accurate than querying the chat users.

About the privacy aspect: Maybe you could add a setting for the user to generally disallow listing his account in this type of request. Another approach would be to require a scope in the streamers account, so the API requester needs the “confirmation” of him, so your data is not completely public. Protecting the data with an additional scope on the viewer side is to complicated for some use cases in my opinion, even if I would be happy with this solution, too.

1 Like

It’s the only way to do it, without changing Twitch’s Privacy policy to say “Hey we are gonna let the people you watch see if you are watching and let them release this information to third parties without you (the viewers) permission”

I as a viewer don’t want that, hence it has to be a viewer scope. So I have control over who sees what, as apposed to a blanket yay/nay option

1 Like

Agree with @george and @BarryCarlyon. It would have to be gated behind an explicit user action and authorization for privacy and data protection reasons.

I agree with what has been said, but I believe
https://tmi.twitch.tv/group/user/YOUR_CHANNEL/chatters
does what you originally wanted to, if you’re still interested.

@martmists My understanding of the request is that the list would exclude people who are just in chat via IRC. That endpoint, which is unsupported and can change at any time, contains everybody whether they’re watching the video or not.

I managed to get this working by using TMI.

$client = new \GuzzleHttp\Client();

    $res = $client->request('GET', 'https://tmi.twitch.tv/group/user/{your_channel}/chatters');

    $viewer_names = json_decode($res->getBody());    

    $channel['viewer_names'] = $viewer_names;

Thats people only in chat, not people who are specifically watching the stream, which is the original query of the thread (for clarity)

It was my understanding that all the people that are in the chat are viewing the stream?

Thats incorrect

For example I can open https://twitch.tv/twitch/chat and show in the TMI viewer list and yet I’m not watching the stream :slight_smile:

ah I understand now, yeh i ported the chat into our website so it doesnt matter if theyre vieweing on the site of the stream, just so you know i just tested kraken for all the requests and you cannot get the exact viewers directly from the api from what i saw.

well you can get a count but you can’t get a list of names

Viewers comes from the /streams endpoint, and the actual variable name is ‘viewers’

There’s another item called ‘views’ that is part of the channel endpoint (which is embedded in the stream endpoint) which is the channels total views (not current viewers)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.