を使用してgoogle-api-nodejs-client
おり、アップローダーのスクリプトを作成しようとしています。ようやくすべてが OAuth2 認証され、リクエストを行える段階に到達しました。
ただし、アップロードしようとすると、403 - Download Service Forbidden エラーが発生します。エラーをグーグルで調べてもまったく何も返されず (最近では珍しいことです)、公式のエラー コード リストには記載されていません。
以下に JSON 応答を添付しました。
{ errors:
[ { domain: 'global',
reason: 'downloadServiceForbidden',
message: 'Download Service Forbidden' },
[length]: 1 ],
code: 403,
message: 'Download Service Forbidden' }
誰かがこれを見たことがありますか、それが何を意味するのか知っていますか?
私のアップロードコード。
var yt_api = googleapis.discover('youtube', 'v3');
var auth_scopes = [
"https://www.googleapis.com/auth/youtube",
"https://www.googleapis.com/auth/youtube.upload",
"https://www.googleapis.com/auth/youtubepartner"
]
var authClient = new googleapis.OAuth2Client(CLIENT_ID, CLIENT_SECRET, REDIRECT_URL);
//performs the authorisation with the above scopes
ensureAuthorisation(authClient, doRequest);
function doRequest() {
log.msg('Executing...');
yt_api.execute(function(err, client){
// open the video as a stream
var buffer = fs.readFileSync('../files/test.mp4');
client
.youtube.videos.insert({part: "contentDetails", mine: true})
.withAuthClient(authClient)
.withMedia('video/*', buffer)
.execute(function(err, response){
if (err) {
log.err("Error in upload");
dumpObj(err);
} else {
log.msg("Succeeded!");
}
});
});
}
ありがとう!