this post was submitted on 28 Mar 2024
10 points (100.0% liked)

Web Development

3454 readers
1 users here now

Welcome to the web development community! This is a place to post, discuss, get help about, etc. anything related to web development

What is web development?

Web development is the process of creating websites or web applications

Rules/Guidelines

Related Communities

Wormhole

Some webdev blogsNot sure what to post in here? Want some web development related things to read?

Heres a couple blogs that have web development related content

CreditsIcon base by Delapouite under CC BY 3.0 with modifications to add a gradient

founded 2 years ago
MODERATORS
 

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...

you are viewing a single comment's thread
view the rest of the comments
[โ€“] [email protected] 1 points 8 months ago (1 children)

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 1 points 8 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.