I am trying to make my own twitch bot and from research was told “http://tmi.twitch.tv/group/user/CHANNEL_NAME/chatters” is the best way to track watch time of users. Except I have no idea how to extract the users’ data from the link
There is no way for you to track a users watch time. That endpoint you listed just returns the list of users who are in chat, that doesn’t mean that they are actually watching the stream at all. That endpoint is also undocumented and subject to being removed, or changed, at any time and without warning.
Also, if you’re wanting to track user data you may want to be careful of the legal issue surrounding privacy laws, specifically GDPR compliance.
I was thinking more for a loyalty program using points pre certain amount of time. That’s all. I’ve seen other bots do it, how do they do it?
Some loyalty bots use that endpoint and just accept that it’ll be inaccurate and easy to game the system by people who may not even have the stream open, and also aware that at some point in the future that endpoint will likely be removed and make their points system no longer viable.
Other loyalty points systems use extensions, which can be somewhat easier to maintain compliance with GDPR and other privacy laws as those sort of loyalty points systems are opt-in as the user has to choose to share their ID. Extensions have the downside though that not all platforms can use them.
The most accurate points system is Twitch’s own channel points system. 3rd party integration is very limited at the moment, but there are more endpoints planned for it in the future.
Okay sounds good, I’ll just work on other features until those endpoints come out. Thanks for the help!
Pull the data via webrequest, output the result to a stream, read the stream to a string than filter.
I have made a somewhat reliable way of tracking viewers/watchtime.
Unfortunately this only counts for users who are logged into their account.
*Edit: Twitch updates the viewers every 2 mintutes, soif you pull the data every 2 minutes you can track viewer time.
I have coded this library in C# and it will be publicly available on my Github soon
This is an undocumented endpoint, so can and will break/change at times and could be removed without warning.
It’s a list of chatters, not viewers. It’s entirely possible to be in that list and not have the stream running, or the reverse be watching the stream (logged in or logged out) and not be on that list. You have no reliable way to track view time per user.
The cache can vary, dont assume it’ll always be 2 minutes. Under some conditions it can be longer.
If you’re tracking users I hope you have their consent and are following all privacy laws.
Why did you need to a bump a year and a half old thread?
Ofcoarse its undocumented. Im yet to find an API that can do anything of the sort.
As for the endpoint, i do have an experimental fallback class in the case my initial goes down.
Its as inaccurate as checking the viewers in the chat section, thats the best i could do.
2 minutes seems to be a reliable number based on my research, if it doesnt update, it will retry in another minute, and so on 🤷
Tracking users? Oh please, save it.
If that were the case, should i ask for consent before looking at someone elses twitch name? A security breach is not the case here…
I answered a question while doing research, there isnt much (or any) documentation or discussion on the topic, im simply helping other devs out in future for reference.
Have a good day Sir.
That’s because it’s not a supported use case, and has potential legal implications.
Well yeah, because this is the exact same data that the chat list on the site uses so of course they are as inaccurate as each other.
This is not about security, this is about privacy. Tracking a user without their consent can violate privacy laws such as GDPR.
Well if youre wanting to help others, perhaps don’t wrongly tell them you “have made a somewhat reliable way of tracking viewers/watchtime.”. What you’ve done is simply checked who’s currently connected to chat that’s logged in. That’s not a reliable or accurate way to monitor view time from a particular user.
There is NO way for a 3rd party developer to track viewership per user. Game Devs used to be able to do so with VHS but even that system was deprecated and removed.
Im not here to argue a point, the guy asked how to extract the data and i told him, also told him about a library i made that does it.
If you had read the thread you would have seen that it was explained the issues with using this endpoint for the ops use case and that at the time a better solution would be the Channel Points system.
The user said they’d wait for the channel points endpoints. Since that time those endpoints for interacting with Channel Points have been released and documented so this topic was already resolved and didn’t need to be necroed to advertise your library.
If you want to advertise your stuff there are places for that, such as the dev showcase Channel on the TwitchDev discord, or the Twitch lib discord server where all the other libs are, or created a new thread to talk about you lib here on these forums rather than bumping old threads.
If you had read his question he asked how to extract the data from there.
You didnt answer his question, you gave him an explanation on why he shouldnt use that method.
Im not advertising anything, i wouldnt even find a need to advertise something open source either.
Where are you going with this whole convo? Why are you salty i answered a question anyway? Are you a moderator?
This thread is now closed due to wandering off of the original topic.
The original topic was how to obtain watch time of a viewer. And the OP was misinformed on how this could be done
You can’t is the simple answer, as there are no supported endpoints for watch time.