YouTube Api

I want to make a program for a YouTuber that displays any new comments. Is it possible to have the API run a function once it receives a comment? Or do I have to check for any new comments every interval?
9 Replies
The Fog from Human Resources
Check the api documentation, iirc comments only get live updated on live chats of streams I think in order to get new comments you need to run new api calls
🌸 morgan period 🌸
Would making a new comment list call every .5 seconds be fine? That way it's somewhat live updated
The Fog from Human Resources
It would be fine but take into consideration possible api costs and rate limits Otherwise yeah sure that's perfectly fine I think
Jimmacle
Jimmacle•5mo ago
you will most likely hit a rate limit polling that fast, but you'd have to check their documentation for details
🌸 morgan period 🌸
Yeah, looks like the best I could do is every 9 seconds
Jimmacle
Jimmacle•5mo ago
which is honestly probably fast enough what are you trying to do that needs to immediately know if there are new comments?
🌸 morgan period 🌸
It doesn't need that I suppose. It's just a statistics display and real time comments would be cool but can kind of be faked if I call the api, idk, every minute than randomly space the comments out with delays
Sossenbinder
Sossenbinder•5mo ago
I think you're gonna need to do polling, IIRC youtube has a 10k limit per day for the free api token, so that might be a bit of a challenge to find a good interval They also have push notifications but I think only for uploads, not for comments I worked on this a while ago, looking for it...
Want results from more Discord servers?
Add your server