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

Web Development

3434 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 1 year 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...

no comments (yet)
sorted by: hot top controversial new old
there doesn't seem to be anything here