Is it possible for me to grab (download) a full list of transcripts from a youtube channel’s videos. I am working on a small project, of which I need a list of the videos, like all of them to control+f and find specific words.

I was wondering if anyone knew of such program I could use.

However, I wrote this AppScript in Google Drive, of which I’m not sure if this will work. It uses high level Google Account Access.

function getYouTubeTranscripts() {
  const CHANNEL_ID = "UCtMVHI3AJD4Qk4hcbZnI9ZQ";

      // This below is what, before Oath (ing), is what Google is saying its unsafe, and does not let me continue...
  const youtube = YouTubeApp.getOAuth2Service().getService();
  const videoIds = youtube.search().list("id", { channelId: CHANNEL_ID, maxResults: 50 }).items.map(item => item.id.videoId);

  videoIds.forEach(videoId => {
    const captions = youtube.captions().list("snippet", { videoId }).items;
    if (captions.length > 0) {
      const captionId = captions[0].id;
      const transcript = youtube.captions().download(captionId, { tfmt: "srt" }).getContentText();
      DriveApp.createFile(`${videoId}.txt`, transcript, "text/plain");
      Logger.log(`Transcript for video ${videoId} saved.`);
    } else {
      Logger.log(`No transcript found for video ${videoId}.`);
    }
  });
}

Just wondering of anything else I could use…

  • SubArcticTundra
    link
    fedilink
    arrow-up
    1
    ·
    9 months ago

    Hmm, youd need to first get a list of channel videos and then iterate thrpugh them, probablu with a script. Yt-dlp might support getting the videos in a channel, idk. I do know that it can download while playlists… Perhaps try passing it the channel url and seeing if it treats that as a playlost.

    • BehindTheBarrier@programming.dev
      link
      fedilink
      arrow-up
      1
      ·
      9 months ago

      YouTube sometimes made it hard to find, but all channels do have an all videos Playlist. I think he button is on a profiles video page now. I don’t know if yt-dlp can do only transcripts but I’m sure it can download all videos with transcripts included.