Quantcast
Channel: Active questions tagged youtube-api - Stack Overflow
Viewing all articles
Browse latest Browse all 3832

Youtube Data API - Publish to Youtube Shorts

$
0
0

I'm using the following code to publish regular videos to Youtube.

Can I publish to Youtube Shorts using Youtube's Data API?

I've tried including #Shorts in the title and/or description as well varios categories Ids with no success.

Anyone managed to do it?

static async uploadVideo(auth, videoTitle, videoDescription, videoUrl, is_private,publishDate) {    const youtube = google.youtube({ version: 'v3', auth });    const status = {privacyStatus: is_private ? 'private' : 'public'};    if (publishDate) {      status.publishAt = publishDate    }    const videoMetadata = {        snippet: {            title: videoTitle || 'Default Video Title',            description: videoDescription || 'Default Video Description',            categoryId : '42'        },        status    };    const videoStream = await this.fetchVideoStream(videoUrl);    if (videoStream) {      const res = await youtube.videos.insert(        {            part: 'snippet,status',            requestBody: videoMetadata,            media: {                body: videoStream,            },        },        {            onUploadProgress: (event) => {                const progress = (event.bytesRead / event.totalBytes) * 100;                console.log(`Upload progress: ${progress.toFixed(2)}%`);            },        }      );      return {          title: res.data.snippet.title,          id: res.data.id,      };    }    else {      console.log('VIDEO STREAM FAILED',videoStream);    }  }

Viewing all articles
Browse latest Browse all 3832

Trending Articles