I'm using the google-api-nodejs-client
and I'm trying to script up an uploader. I've finally got to the stage where everything is OAuth2 authenticated and I can make requests.
When trying to do an upload however, I'm getting 403 - Download Service Forbidden errors. Googling the error is returning utterly nothing (a rarity these days), and the official error code listing doesn't list it.
I've attached the JSON response below.
{ errors:
[ { domain: 'global',
reason: 'downloadServiceForbidden',
message: 'Download Service Forbidden' },
[length]: 1 ],
code: 403,
message: 'Download Service Forbidden' }
Has anyone seen this or knows what it means?
My upload code.
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!");
}
});
});
}
Thanks!