是否有替代 youtube.search.list 来查询另一个频道的活动直播? [英] Is there an alternative to youtube.search.list for querying of active Livestreams of another channel?
问题描述
由于 YouTube Data v3 API 有配额限制,而 youtube.search.* 的最低影响是 100 个配额(考虑到您开始时每天只能获得 10000 个配额,这已经很多了),所以有没有 youtube 的替代方案.search.list 函数通过 ID 查询另一个(非授权)频道的活动直播流?
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}
这会消耗上述每个请求 100 个配额的最小值.我以前也使用 youtube.search.list API 来监控正常上传,但我发现我可以用 youtube.activities 替换它,我希望有一个很好的替代品来使用 youtube.search.list 进行直播我不也跑.
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.
我需要/想要这个,因为我的客户(一个简单的不和谐机器人)具有自动宣布新上传或宣布一个特定频道的直播的功能,应该有一些最新的数据.为此使用 youtube.search.list API 将限制我只能每 30 分钟左右刷新一次这些数据,在我走这条路之前,我将省略自动直播检查:/
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 :/
推荐答案
也许你应该改变你的应用程序模型:
Maybe you should change your application model:
不是定期拉取——以恒定速率,但由于默认配额施加的限制而无法令人满意——通过 API 的搜索端点或其他东西(例如,活动端点或 playlistItems 端点查询频道的上传列表),利用所谓的 API 推送通知.
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.
这篇关于是否有替代 youtube.search.list 来查询另一个频道的活动直播?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!