google-apps-script - 新项目的 Youtube 配额
问题描述
我第一次将 Youtube API 与 Apps 脚本一起使用,但出现配额错误。我从 Apps Script 窗口激活了 Youtube API,并添加了我的脚本。
注意我使用的是 Google Workspace 帐户。我的私人谷歌帐户没有这个问题。
这是生成错误的代码:
function getVids() {
var list = YouTube.Search.list('id,snippet', {
channelId: 'UCYf_kU_HoMOUUe3hW-0ou5Q',
maxResults: 25
})
var json = JSON.parse(list);
var items = list.items;
var allVideos = [];
for (var i=1; i<items.length;i++) {
var videoId = list.items[i].id.videoId;
allVideos.push(videoId);
}
console.log(allVideos)
}
我收到此错误:
GoogleJsonResponseException: API call to youtube.videos.insert failed with error: The request cannot be completed because you have exceeded your quota。
我试着在这里查看消费情况:https ://console.developers.google.com/apis/dashboard但它会将我重定向到https://console.developers.google.com/apis/dashboard?project=northern-math- 286006&folder=&organizationId=我认为这是一些默认项目名称,因为我没有选择它。我从此页面选择了https://console.developers.google.com/apis/api/youtube.googleapis.com/overview?folder=&organizationId=&project=northern-math-286006来查看 Youtube 数据,但它返回“无数据在选定的时间范围内可用。”
解决方案
解释:
根据官方文档,您每天已超过10,000 个单位。
单位点可能有点难以理解,但上面的链接本身有一个很好的解释:
您正在执行搜索请求,并且对于每个搜索请求,您花费100 个单位。我假设您已经执行了此代码和/或其他消耗积分的代码,这就是您达到最大单位积分的原因。
根据此处的文档,您可以查看您的配额使用情况,但您可能需要获得访问该信息的权限。
YouTube 数据 API (v3) - 配额计算器:
如果您的应用程序调用返回多页结果的方法(例如 search.list),则检索额外结果页的每个请求都会产生估计的配额成本。
推荐阅读
- c++ - FreeType 库不与教程代码一起显示
- python - Pandas:索引 0 超出轴 0 的范围,大小为 0
- java - Edittext 在上述 android N 的对话框中无法接收来自键盘的输入
- angular - 如何在单个构建命令中在 Angular 7 项目中构建多个应用程序?
- html - 如何配置 webpack 以使用预构建的 svg sprite?
- yii2 - Yii2 DepDrop Kartik 小部件
- batch-file - 如何使用 WMIC 在所有物理端口(包括断开连接的媒体端口)上强制 DHCP
- .net - 类似于泛型的接口或派生类
- filtering - 如何从wireshark日志中获取时间间隔内的数据包计数
- java - 写入关注错误:BulkWriteConcernError{code=64, message='waiting for replication timeout', details={ "wtimeout" : true }}