Pages

marți, 15 septembrie 2026

Google Apps Script : show tags videos from youtube playlist.

Today marks the first part of managing tags for uploaded YouTube videos. Assigning the right tags to every video is challenging and time-consuming; plus, if you rush, you might lose track of what you’ve uploaded. This Google Apps Script displays the tags for the videos in a playlist. While it is possible to use a script to automatically check and modify them, that process is more complex. Here is the initial, simple script for my main playlist on the @catafest YouTube channel.
function showAllVideoTagsFromPlaylist() {
  const playlistId = "PLIDHlEkMih2OssDFquu0iWSNOTsFeuk8v";
  let pageToken = null;
  do {
    const playlistResponse =
      YouTube.PlaylistItems.list(
        "snippet",
        {
          playlistId: playlistId,
          maxResults: 50,
          pageToken: pageToken
        }
      );
    playlistResponse.items.forEach(item => {
      const videoId =
        item.snippet.resourceId.videoId;
      const videoResponse =
        YouTube.Videos.list(
          "snippet",
          {
            id: videoId
          }
        );
      if (!videoResponse.items.length) {
        return;
      }
      const video =
        videoResponse.items[0];
      const tags =
        video.snippet.tags || [];
      Logger.log("====================================");
      Logger.log("TITLE: " + video.snippet.title);
      Logger.log("VIDEO ID: " + videoId);
      Logger.log("TAGS: " + tags.join(", "));
    });
    pageToken = playlistResponse.nextPageToken;
  } while (pageToken);
}