Search code examples
node.jsgoogle-apiyoutube-apiyoutube-data-apigoogle-api-nodejs-client

Videos uploaded with API get locked to private


What I'm trying to do

I want to automatically upload a video my code generates every day to my YouTube channel. It should upload the video file and add the thumbnail.

What goes wrong

When I let my code upload the video, the video plays fine and everything works, but there's a restriction on the video that causes it to be locked on private. No further information is given and appealing is not possible. I've tried uploading as unlisted after which everything seems fine. However, when I manually set it to public, even after waiting 12 hours, the video is locked on private yet again.

Video illustrating the issue:

https://youtu.be/hRUV023nshI

How do avoid this issue and make sure people can see the video? I can't find anything that would be against the terms and policies of YouTube. When I upload the exact same video manually, everything works fine.

My code

I'm using the google-api-nodejs-client with OAuth2. I generated the authentication URL with:

const authUrl = oauth2Client.generateAuthUrl({
    access_type: "offline",
    scope: [
        "https://www.googleapis.com/auth/youtube",
        "https://www.googleapis.com/auth/youtube.upload",
        "https://www.googleapis.com/auth/youtube.readonly"
    ];
});

Code for uploading video:

youtube.videos.insert(
    {
        auth: auth,
        part: "snippet,contentDetails,status",
        resource: {
            snippet: {
                title: "Title goes here",
                description: "Description goes here",
                tags: ["tags", "go", "here"],
            },
            status: {
                privacyStatus: "private",
                selfDeclaredMadeForKids: false,
            },
        },

        media: {
            body: fs.createReadStream("./video.avi"),
        },
    },
    async (error, data) => {
        if (error)
            return reject(error);
    }
);

Code for changing the thumbnail:


youtube.thumbnails.set(
    {
        auth: auth,
        videoId: videoId,
        media: {
            mimeType: "image/jpeg",
            body: fs.readFileSync(`./thumbnail.png`)
        },
    },
    (err, thumbResponse) => {
        if (err) {
            console.log("Error response");
            console.log(err);
        }
        console.log(thumbResponse);
    }
);

Solution

  • Videos uploaded by applications which have not been though the verification process will be set to private.

    You need to submit your application for verification once you have completed the verification process you will be able to upload public videos.

    This is an update after some clarity from Google.

    At the top of the Video.insert page you will see it states.

    enter image description here

    Audit is not verification, these are two different things. You need to apply for an audit. YouTube API Services - Audit and Quota Extension Form