【问题标题】:YouTube Data API, 10,000 quota reached with just a few hundred PUT updatesYouTube 数据 API,只需数百次 PUT 更新即可达到 10,000 个配额
【发布时间】:2020-04-29 21:44:15
【问题描述】:

我有一个包含近 800 个视频的 YouTube 频道。我正在使用 YouTube Data API V3 来更新每个视频的标题和说明。

这是我正在进行的更新类型的 cURL 示例:

curl --request PUT \
  'https://www.googleapis.com/youtube/v3/videos?part=snippet' \
  --header 'Authorization: Bearer ACCESS_TOKEN' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '{"id":"xxxxxxxxxxx","snippet":{"description":"Updated description, often quite long","title":"Updated title","channelId":23}}' \
  --compressed

这(最终)工作得很好。因此,我着手进行批量更新,为每个视频生成新的标题和描述,并发出单独的 PUT 请求。

问题是,在收到警告之前,我成功更新了大约 175 次:

{
 "error": {
  "errors": [
   {
    "domain": "usageLimits",
    "reason": "dailyLimitExceeded",
    "message": "Daily Limit Exceeded. The quota will be reset at midnight Pacific Time (PT). You may monitor your quota usage and adjust limits in the API Console: https://console.developers.google.com/apis/api/youtube.googleapis.com/quotas?project=xxxxxxxxxxxxx",
    "extendedHelp": "https://console.developers.google.com/apis/api/youtube.googleapis.com/quotas?project=xxxxxxxxxxxxx"
   }
  ],
  "code": 403,
  "message": "Daily Limit Exceeded. The quota will be reset at midnight Pacific Time (PT). You may monitor your quota usage and adjust limits in the API Console: https://console.developers.google.com/apis/api/youtube.googleapis.com/quotas?project=xxxxxxxxxxxxx"
 }
}

我在不到 200 次更新中使用了每天 10,000 个请求配额。这怎么可能?

是否有一种方法可以在一个 PUT 请求期间更新多个视频 ID。配额数量如何计算?我似乎找不到任何关于它的数据。

【问题讨论】:

    标签: youtube youtube-api youtube-data-api


    【解决方案1】:

    文档的quota calculator 说,在snippet 部分调用Videos.update 端点的配额成本为53 个单位。

    因此,每天的配额为 10000 个单位 - 如果仅考虑更新 - 在任何一天更新的视频的 snippet 元数据不能超过 188 个。

    【讨论】:

    • 感谢您的启发。这个数字似乎是对的。我最终使用我拥有的一系列 gmail 地址来创建跟踪 Google Cloud 帐户来执行所有 787 更新。我记得几年前使用较旧的 API 版本,这根本不是问题。它只是在更新文本,我很惊讶他们能把它算作这么多单位。
    猜你喜欢
    • 1970-01-01
    • 2022-09-25
    • 1970-01-01
    • 2020-12-13
    • 2021-04-15
    • 2019-08-19
    • 2021-04-21
    • 2021-03-15
    • 2015-08-10
    相关资源
    最近更新 更多