justintv / Twitch-API

A home for details about our API
www.twitch.tv
1.72k stars 379 forks source link

User watching channel authenticated API request #470

Closed mavrick closed 3 years ago

mavrick commented 8 years ago

I would love to be able to ask what channel or channels a user is currently watching and if they are active in chat.

The tmi get requests and twitch IRC bots are only good when the user is active in chat. This doesn't work well when someone is watching from mobile or on chrome cast.

Would love to hear everyone's thoughts and ideas on this.

Cheers

bashtech commented 8 years ago

What would be the use case for an authenticated endpoint for this? This information should not be made available without an explicit grant from the target user's account which would make it inconvenient for most existing scenarios (eg loyalty bots).

mavrick commented 8 years ago

Sorry my explanation may not be correct.

I think you are correct in saying the information should not be public unless using the oauth token from the user.

The main use case for myself is a loyalty bot and so I do not have to enforce the user to watch via a specific website to earn those points.

If there is another way I can do this then I am open to ideas.

Cheers

ghost commented 8 years ago

@bashtech If I'm understanding him correctly (and I may not be) - I think he is wanting a way to get users who are logged in to twitch, but not to chat. Right now, viewers fall into a completely anonymous bucket, where chatters can be tracked for loyalty where you can do coins, and whatever reward structure - but people not logged into the chat can't benefit from that.

While viewers can be 'true anonymous' by not being logged in to twitch, it would be useful to be able to see who is viewing the stream while they authenticated.

bashtech commented 8 years ago

I am personally against that idea as well. Your suggestion to obtain 'true anonymous' status would mean the inability to utilize something like Turbo for watching ad free streams. On Nov 30, 2015 11:08 AM, "TournyMasterBotCurse" notifications@github.com wrote:

@bashtech https://github.com/bashtech If I'm understanding him correctly (and I may not be) - I think he is wanting a way to get users who are logged in to twitch, but not to chat. Right now, viewers fall into a completely anonymous bucket, where chatters can be tracked for loyalty where you can do coins, and whatever reward structure - but people not logged into the chat can't benefit from that.

While viewers can be 'true anonymous' by not being logged in to twitch, it would be useful to be able to see who is viewing the stream while they authenticated.

— Reply to this email directly or view it on GitHub https://github.com/justintv/Twitch-API/issues/470#issuecomment-160673021 .

ghost commented 8 years ago

Couldn't that be easily solved by adding a privacy option 'do not show up in the viewer list' (optionally, by stream)? That way if a user wants to participate they can, if they want to opt out of everything entirely, they can do that too. (This does require development work of course, so where it would fall in priorities...)

freaktechnik commented 8 years ago

So it's the same as joining chat or not joining chat, just that it's more stable for platforms that only show chat when you're actively looking at it.

mavrick commented 8 years ago

@TournyMasterBotCurse - correct. Thanks for saying it better than me :+1:

The tmi endpoint only returns people in chat and relies on the fact the CAP REQ :twitch.tv/membership returns ACK from what I can see from initial testing.

Essentially something like this would be handy

GET /streams/watching

Returns a list of stream objects that the authenticated user is watching.

Authenticated, required scope: user_watching

Example Request

curl -H 'Accept: application/vnd.twitchtv.v3+json' -H 'Authorization: OAuth <access_token>' \
-X GET https://api.twitch.tv/kraken/streams/watching

Example Response

{
 "_total": 1,
"streams": [...]
}

Cheers

freaktechnik commented 8 years ago

I guess this whole concept would also solve the problem of having more than 1000 people and not knowing who's truly there (except if you use undocumented APIs). But then it'd probably lead to a similar situation like with the :channel/following endpoint, which is a long list of username that people poll a lot.