google-api - 为什么 Google 的 YouTube Data API v3 "Queries per day"配额增加量比我调用的要多?

标签 google-api youtube-api youtube-data-api

我每天默认有 10,000 个查询。我向我的程序添加了一些仔细的调试输出,这些输出正在进行调用,以准确查看我正在进行的调用次数:

https://youtube.googleapis.com/youtube/v3/search
  https://youtube.googleapis.com/youtube/v3/channels with 21 channelIds
https://youtube.googleapis.com/youtube/v3/search
  https://youtube.googleapis.com/youtube/v3/channels with 2 channelIds
https://youtube.googleapis.com/youtube/v3/search
  https://youtube.googleapis.com/youtube/v3/channels with 39 channelIds
https://youtube.googleapis.com/youtube/v3/search
  https://youtube.googleapis.com/youtube/v3/channels with 16 channelIds
https://youtube.googleapis.com/youtube/v3/search
  https://youtube.googleapis.com/youtube/v3/channels with 1 channelId
https://youtube.googleapis.com/youtube/v3/search
  https://youtube.googleapis.com/youtube/v3/channels with 8 channelIds
https://youtube.googleapis.com/youtube/v3/search
  https://youtube.googleapis.com/youtube/v3/channels with 37 channelIds
https://youtube.googleapis.com/youtube/v3/search
  https://youtube.googleapis.com/youtube/v3/channels with 11 channelIds

total search = 8
total channels = 8 calls with 21+2+39+16+1+8+37+11 = 135 channelIds

8 + 8 + 135 = 151

我只发出了 16 个 http 请求,其中 8 个用于搜索,8 个用于 channel 。 channel 调用中的 id 字段是逗号分隔的 id 列表。因此,将每一个都算作另一个“命中”,那么总共 151 次,就多了 135 次。

但是,运行此命令后,我的配额报告了 10,000 次限制中的 808 次点击!为什么我所调用的电话与达到配额之间存在巨大差异?

每个都将 maxResults 设置为 50,我是否需要为每个返回结果与每个 http 调用付费?

最佳答案

更正一下,您每天有 10000 个单位。这并不意味着您可以发出 10000 个请求。

The YouTube Data API uses a quota system to ensure that developers use the service as intended and do not create API clients that unfairly reduce service quality or limit access for others.

Projects that enable the YouTube Data API have a default quota allocation of 10,000 units per day, an amount sufficient for the majority of our API users. You can see your quota usage on the Quotas page in the API Console.

正如您所见,YouTube API 是基于费用的,每个请求都意味着您的总配额会产生费用。

例如。 search.list 方法需要 100 点才能发出请求。

这给你 10000/100 = 100

在配额用完之前,您可以提出 100 个请求。

有用的链接:

关于google-api - 为什么 Google 的 YouTube Data API v3 "Queries per day"配额增加量比我调用的要多?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72647626/

相关文章:

python - 使用 Google 的自定义搜索 JSON API 的搜索结果不一致

ruby - 访问 Google API 时的 OAuth 2.0 示例错误

java - 谷歌计算 API 支持 promise 吗?

android - Android Youtube API 是否使用官方 Youtube 应用程序播放视频?

android - 无法加载现代控件 UI。升级到最新版本的 Android YouTube API

youtube - TotalResults 计数与 YouTube v3 搜索 API 中返回的实际结果不匹配

java - 无法为实时流打开输出容器

java - 如何获取 Youtube Api Json 响应

javascript - 将 Google map 街景小人放在标记下方

youtube - YouTube搜索API不返回sd/max分辨率缩略图