1

I recently encountered a problem in YouTube uploads, the code below show how to take the video and upload it in YT. Everything works fine, so it uploads the video, but doesn't make it public. The video format is .mp4 and weighs less than 5MB. Thanks to anyone who can help me

function prendiVideo(today,idDoc,idFolder) {

  var description,folder,fileIter,file,name,id,blob,requestBody;

  description = DocumentApp.openById(idDoc).getBody().getText();
  folder=DriveApp.getFolderById(idFolder);
  fileIter=folder.getFiles();

  Logger.log(fileIter);

  while(fileIter.hasNext()){

    file=fileIter.next();
    name=file.getName();

    Logger.log(name);

    id=file.getId();
    controll="name video"+today;

    if(name===contoll){

      blob = DriveApp.getFileById(id).getBlob();
  
      requestBody = {
        "snippet": {
          "title": name,
          "description": "description here: #one #two #three "+description,
          "tags": ["tag1","tag2"],
          "categoryId": "22"
        },
        "status": {
          "privacyStatus": "public"
        }
      }

      YouTube.Videos.insert(requestBody, "snippet,status", blob);

    }
  }
}
stvar
  • 6,551
  • 2
  • 13
  • 28
  • 3
    This is the answer to your question: [Using Youtube Data API makes my videos private on upload](https://stackoverflow.com/a/64080239/8327971). – stvar Sep 16 '21 at 10:24

0 Answers0