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

Google Script updating my Youtube videos in a weird way [closed]

$
0
0

So I copied a code and modified it on Google Script to made an auto generated title automatically like displaying views, likes, and etc. I got inspired by Tom's video (u could watch it on here)

I got a problem for doing that, the code is worked actually. But it always reset my Tags and my Default Language on video details. When I upload the details like Tags: views, like, and etc. Also, the Default Language I set to Not Applicable always turn to this when the Google Script trigger my code. And this is my code on gs

const updateYouTubeVideo = (e = null) => {  const id = 'abcdefghijk';  const template = 'This video has X Views, Y Likes, and Z Comments!';  // Get the watch statistics of the video  const { items: [video = {}] = [] } = YouTube.Videos.list('snippet, statistics', { id }  );  // Parse the YouTube API response to get views and comment count  const {    snippet: { title: oldTitle, categoryId } = {},    statistics: { viewCount, likeCount, commentCount } = {},  } = video;  if (viewCount && likeCount && commentCount) {    const newTitle = template.replace('X', viewCount).replace('Y', likeCount).replace('Z', commentCount);    // If the video title has not changed, skip this step    if (oldTitle !== newTitle) {      YouTube.Videos.update({        id, snippet: {          title: newTitle, categoryId        }      }, 'snippet'      );    }  }  console.log(video);};

I want to know how to not reset my Tags and Default Language every updates. Thx


Viewing all articles
Browse latest Browse all 3831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>