Youtube v3 API: Error 500 (BackendError) while uploading signature file

I am writing proof-of-concept code to automatically upload captions to existing videos. Here is my code:

var file = $('input[type=file]').get(0).files[0];

var metadata = {
    snippet: {
        videoId: 'xKE5LG5Xd9o',
        language: 'english',
        name: 'test'
    }
};
var uploader = new MediaUploader({
    baseUrl: 'https://www.googleapis.com/upload/youtube/v3/captions',
    file: file,
    token: gapi.auth.getToken().access_token,
    metadata: metadata,
    params: {
        part: 'snippet'
    }
});

uploader.upload();

      

When I run this code, I get the following JSON response:

{
    "error": {
        "errors": [{
            "domain": "global",
            "reason": "backendError",
            "message": "Backend Error"
        }],
        "code": 500,
        "message": "Backend Error"
    }
}

      

I cannot find any recent information on this bug answer. There is this old thread that suggests it is an API bug and that waiting for a period of time before trying again will resolve it. However, it doesn't seem to work in my case.

+3


source to share


1 answer


From my experience with the library, you need to specify the language as the BCP-47 language tag. So it means changing "english" to "en".



var metadata = {
    snippet: {
        videoId: 'xKE5LG5Xd9o',
        language: 'en',
        name: 'test'
    }
};

      

+4


source







All Articles