strem-app / strem

A free and open source automation tool for streamers
MIT License
49 stars 3 forks source link

Add Youtube Integration #62

Open grofit opened 2 years ago

grofit commented 2 years ago

Currently it seems like this would only really be used to hook into chat on live streams as im not entirely sure what else someone would want to do realtime with youtube, so for now its low priority but if anyone can think of other use cases that would make it more important we can bump the priority of it up.

MaddesJG commented 1 year ago

Could be useful to have Chat events trigger something

grofit commented 1 year ago

Yeah I did look into it but their API had some pretty bad usage limits in place when I looked so I was hesitant to jump into it at the time, but its definitely on the todo list.

JayTholen commented 12 months ago

here's this other person's thing as per our chat! https://github.com/einaram/yt-live-chat-poll

grofit commented 12 months ago

So I have done some prototype work on this as unfortunately google has not really adhered to the recommendations for PKCE, a discussion on it can be found here:

Google also in their OWN docs that you should use PKCE for native apps, but then do not let you do so without the secret.

Anyway due to this the only options for auth seem to be:

The former is untenable imo as imagine half way through a stream everything stops working and you need to go log back in to google to get it working for another hour.

The latter is VERY faffy for an end user to setup as they would need to go make their own google developer account and setup their own app with their own oauth credentials to pass on to the app to use. This however would bypass the usage constraints that made me hesitant to implement in the first place, and would mean that you wouldnt need to keep re-logging in.

Currently im toying with the idea of moving Youtube support out of the core library and making it be its own separate plugin with instructions on how to create your own google app etc, this is kinda like how the twitter plugin now works, since they started putting usage constraints in place you have to provide your own twitter app credentials.

Also its worth reading this StackOverflow Post around quota costs of using the youtube api, which is one of the reasons I originally put this on the todo list rather than implementing at same time of Twitch.

There are workarounds where you can load a hidden browser which tracks the messages but that may have other issues and hoops to jump through, it feels like google really only gears these APIs to enterprise customers and not peasants like us :D

grofit commented 7 months ago

Marking this as blocked as I am unsure on best legal and usable way forward with this, however I have a proof of concept as mentioned above which details the "correct" way to do it which costs a LOT of money, or another approach which loads up another window to track chat but then you have a window floating around which isnt great.

If there is someone else who wants to be a user champion for this comment in here and happy to work with you to try and find a way forward with it.