Is there an alternative to youtube.search.list for

2020-07-30 03:30发布

问题:

Since the YouTube Data v3 API has a quota limit and youtube.search.* has a minimum impact of 100 quota (which is a lot considering you only get 10000/day to start with) is there an alternative to the youtube.search.list function to query active LiveStreams for another (non authorised) channel by ID?

https://www.googleapis.com/youtube/v3/search?part=snippet&channelId={CHANNEL-ID}&eventType=live&type=video&maxResults=1&order=date&key={API-KEY}

This consumes the said minimum of 100 quota per request. I had previously used the youtube.search.list API too to monitor normal uploads but I found out that I can replace that with youtube.activities, I hope there is a good replacement to using youtube.search.list for Livestreams I don't run too.

I need/want this because my client (a simple discord bot) which has the function to automatically announce new uploads or announce livestreams for one specific channel, should have somewhat up-to-date data. Using the youtube.search.list API for this would limit me to only refreshing this data once every 30 minutes or so and before I go down that path I'll just omit automatic Livestream checking :/

回答1:

Maybe you should change your application model:

Instead of regularly pulling -- at a constant rate, but unsatisfactory due to limitations imposed by default quotas -- a channel's uploads list via the API's search endpoint or something else (e.g. the activities endpoint or the playlistItems endpoint queried for the channel's uploads list), make use of the so-called API push notifications.

It is a more involved solution with different upfront requirements, but, if indeed you need real time announcements, then that will suit you more effectively, I think.