A few friends and I are working on an application/extension to combat the issue of view and follow bots. I think I’ve found a way to prevent this, but it would require getting the bots IP address in order to determine if a large group of viewers in a given channel are from the same location.
Is there a way to get a viewers IP address from the twitch API?
There are other ways of solving this issue I am tossing around but I am trying to explore this option first.
There is no way to get any users IP, as that would violate privacy. Twitch has a process on how to handle botting on their help page. Best is just to follow their process, and report them.
You shouldn’t be doing thing else other than whats in that guide.
You lack the ability to collect the needed information as you don’t control Twitch’s servers, and the ability to block people you think are view botters from watching the stream or affecting Twitch’s view count.
It’s also worth bearing in mind that Follow bots don’t even need to view the channel to follow it, so they are impossible for anyone but Twitch to track at all.
View bots can view the stream and count as a viewer without loading any extensions or 3rd party content so again you as a broadcaster would have no way to track them.
And even if you did want to use an extension in some way to do what you’re suggesting, an IP address comes under personal information in the GDPR so if you used a Twitch Extension to collect that without the users consent then you as a developer, and potentially your Twitch channel, would be legally liable for that GDPR violation, and potential breach of Twitch’s Developer Agreement and ToS yourself.
No “cavalier” was intended, you just need to be aware of the privacy implications and the fact you cannot collect the data you need to collect, nor can you apply any effect on Twitch to “fix” the problem.