无法完成请求,因为您已超出配额
The request cannot be completed because you have exceeded your quota
我尝试使用 javascript MediaUploader.js 将 youtube 视频上传到我自己的帐户,由于某种原因,我在 onError 函数中遇到此错误:
"errors": [
{
"domain": "youtube.quota",
"reason": "quotaExceeded",
"message": "The request cannot be completed because you have exceeded your \u003ca href=\"/youtube/v3/getting-started#quota\"\u003equota\u003c/a\u003e."
}
],
"code": 403,
"message": "The request cannot be completed because you have exceeded your \u003ca href=\"/youtube/v3/getting-started#quota\"\u003equota\u003c/a\u003e."
今天只测试了几次,就出现了这个奇怪的错误。
var signinCallback = function (tokens, file){
console.log("signinCallback tokens: ",tokens);
if(tokens.accessToken) { //tokens.access_token
console.log("signinCallback tokens.accessToken: ",tokens.accessToken);
var metadata = {
id: "101",
snippet: {
"title": "Test video upload",
"description":"Description of uploaded video",
"categoryId": "22",//22
"tags": ["test tag1", "test tag2"],
},
status: {
"privacyStatus": "private",
"embeddable": true,
"license": "youtube"
}
};
console.log("signinCallback Object.keys(metadata).join(','): ",Object.keys(metadata).join(','));
var options = {
url: 'https://www.googleapis.com/upload/youtube/v3/videos?part=snippet%2Cstatus&key=<my api key>',
file: file,
token: tokens.accessToken,
metadata: metadata,
contentType: 'application/octet-stream',//"video/*",
params: {
part: Object.keys(metadata).join(',')
},
onError: function(data) {
var message = data;
// Assuming the error is raised by the YouTube API, data will be
// a JSON string with error.message set. That may not be the
// only time onError will be raised, though.
try {
console.log("signinCallback onError data: ",data);
if(data!="Not Found"){
var errorResponse = JSON.parse(data);
message = errorResponse.error.message;
console.log("signinCallback onError message: ",message);
console.log("signinCallback onError errorResponse: ",errorResponse);
}else{
}
} finally {
console.log("signinCallback error.... ");
}
}.bind(this),
onProgress: function(data) {
var currentTime = Date.now();
var bytesUploaded = data.loaded;
var totalBytes = data.total;
// The times are in millis, so we need to divide by 1000 to get seconds.
var bytesPerSecond = bytesUploaded / ((currentTime - this.uploadStartTime) / 1000);
var estimatedSecondsRemaining = (totalBytes - bytesUploaded) / bytesPerSecond;
var percentageComplete = (bytesUploaded * 100) / totalBytes;
console.log("signinCallback onProgress bytesUploaded, totalBytes: ",bytesUploaded, totalBytes);
console.log("signinCallback onProgress percentageComplete: ",percentageComplete);
}.bind(this),
onComplete: function(data) {
console.log("signinCallback onComplete data: ",data);
var uploadResponse = JSON.parse(data);
this.videoId = uploadResponse.id;
//this.pollForVideoStatus();
}.bind(this)
}
MediaUpload.videoUploader(options);
}
};
我在开发者控制台查看了我的配额,我的配额限制这么大,我不可能超过我的配额,ex,我今天总共有89个查询,我的配额限制是10,000 queries/day.
预期:成功将我的视频上传到我的 youtube 帐户。
实际结果:quotaExceeded
Youtube 不是每天给你 10,000 个查询,而是每天给你 10,000 个单位;一个查询可以是多个单元,具体取决于您在做什么:
A simple read operation that only retrieves the ID of each returned
resource has a cost of approximately 1 unit.
A write operation has a cost of approximately 50 units.
A video upload has a cost of approximately 1600 units.
如果您的 89 个查询包含视频上传或写入操作,那么就可以解释您的问题
更多信息:
https://developers.google.com/youtube/v3/getting-started#quota
损坏 Google 开发者项目 - 创建一个新项目
我很失望 Google 我就是这种情况。
I had the same issue, no usage at all but "quota exceeded" response. My solution was to create a new project. I guess it's because something changed internally over time and wasn't applied correctly to (at least my) already existing project...
出于多种原因,我已经停止使用 AWS,并认为 Google 云会是一种令人耳目一新的体验,但这表明我 Google 对待现有项目的态度与对待新产品一样糟糕,它会扼杀它。击中 Google.
https://github.com/googleapis/google-api-nodejs-client/issues/2263#issuecomment-741892605
我尝试使用 javascript MediaUploader.js 将 youtube 视频上传到我自己的帐户,由于某种原因,我在 onError 函数中遇到此错误:
"errors": [
{
"domain": "youtube.quota",
"reason": "quotaExceeded",
"message": "The request cannot be completed because you have exceeded your \u003ca href=\"/youtube/v3/getting-started#quota\"\u003equota\u003c/a\u003e."
}
],
"code": 403,
"message": "The request cannot be completed because you have exceeded your \u003ca href=\"/youtube/v3/getting-started#quota\"\u003equota\u003c/a\u003e."
今天只测试了几次,就出现了这个奇怪的错误。
var signinCallback = function (tokens, file){
console.log("signinCallback tokens: ",tokens);
if(tokens.accessToken) { //tokens.access_token
console.log("signinCallback tokens.accessToken: ",tokens.accessToken);
var metadata = {
id: "101",
snippet: {
"title": "Test video upload",
"description":"Description of uploaded video",
"categoryId": "22",//22
"tags": ["test tag1", "test tag2"],
},
status: {
"privacyStatus": "private",
"embeddable": true,
"license": "youtube"
}
};
console.log("signinCallback Object.keys(metadata).join(','): ",Object.keys(metadata).join(','));
var options = {
url: 'https://www.googleapis.com/upload/youtube/v3/videos?part=snippet%2Cstatus&key=<my api key>',
file: file,
token: tokens.accessToken,
metadata: metadata,
contentType: 'application/octet-stream',//"video/*",
params: {
part: Object.keys(metadata).join(',')
},
onError: function(data) {
var message = data;
// Assuming the error is raised by the YouTube API, data will be
// a JSON string with error.message set. That may not be the
// only time onError will be raised, though.
try {
console.log("signinCallback onError data: ",data);
if(data!="Not Found"){
var errorResponse = JSON.parse(data);
message = errorResponse.error.message;
console.log("signinCallback onError message: ",message);
console.log("signinCallback onError errorResponse: ",errorResponse);
}else{
}
} finally {
console.log("signinCallback error.... ");
}
}.bind(this),
onProgress: function(data) {
var currentTime = Date.now();
var bytesUploaded = data.loaded;
var totalBytes = data.total;
// The times are in millis, so we need to divide by 1000 to get seconds.
var bytesPerSecond = bytesUploaded / ((currentTime - this.uploadStartTime) / 1000);
var estimatedSecondsRemaining = (totalBytes - bytesUploaded) / bytesPerSecond;
var percentageComplete = (bytesUploaded * 100) / totalBytes;
console.log("signinCallback onProgress bytesUploaded, totalBytes: ",bytesUploaded, totalBytes);
console.log("signinCallback onProgress percentageComplete: ",percentageComplete);
}.bind(this),
onComplete: function(data) {
console.log("signinCallback onComplete data: ",data);
var uploadResponse = JSON.parse(data);
this.videoId = uploadResponse.id;
//this.pollForVideoStatus();
}.bind(this)
}
MediaUpload.videoUploader(options);
}
};
我在开发者控制台查看了我的配额,我的配额限制这么大,我不可能超过我的配额,ex,我今天总共有89个查询,我的配额限制是10,000 queries/day.
预期:成功将我的视频上传到我的 youtube 帐户。 实际结果:quotaExceeded
Youtube 不是每天给你 10,000 个查询,而是每天给你 10,000 个单位;一个查询可以是多个单元,具体取决于您在做什么:
A simple read operation that only retrieves the ID of each returned resource has a cost of approximately 1 unit.
A write operation has a cost of approximately 50 units.
A video upload has a cost of approximately 1600 units.
如果您的 89 个查询包含视频上传或写入操作,那么就可以解释您的问题
更多信息: https://developers.google.com/youtube/v3/getting-started#quota
损坏 Google 开发者项目 - 创建一个新项目
我很失望 Google 我就是这种情况。
I had the same issue, no usage at all but "quota exceeded" response. My solution was to create a new project. I guess it's because something changed internally over time and wasn't applied correctly to (at least my) already existing project...
出于多种原因,我已经停止使用 AWS,并认为 Google 云会是一种令人耳目一新的体验,但这表明我 Google 对待现有项目的态度与对待新产品一样糟糕,它会扼杀它。击中 Google.
https://github.com/googleapis/google-api-nodejs-client/issues/2263#issuecomment-741892605