I am using this Apps Script code to upload videos from Google Drive to my YouTube channel, which works fine.
I have created another channel under my Google account and want to upload videos to this second channel. How do I specify the ID of the second channel in the code?
Because when using the code and specifying the second channel with:
id=CHANNEL_ID
The code still uploads the video to the first channel (which is created by default with a Google account).
I also note that an authorization window appears the first time the code is executed. But it allows authorization only through a Google account. If you try to choose authorization through the second YouTube channel - it will give an error:
function uploadToYoutube(){ const sourceFile = DriveApp.getFileById(" ").getBlob(); const videoResource = { snippet: { title: 'Summer vacation in California', description: 'Had a great time surfing in Santa Cruz', tags: [ 'surfing', 'Santa Cruz', ], categoryId: '22', }, status: {privacyStatus: 'private'} // Added; }; const newVideo = YouTube.Videos.insert( videoResource, "snippet,status", sourceFile); // Modified console.log(newVideo) }