Skip to main content
Glama

youtube-transcript-extractor

Extract text transcripts from YouTube videos to analyze and work with video content directly.

Instructions

Extracts the transcript of a YouTube video.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputYesa youtube video url

Implementation Reference

  • index.ts:20-35 (handler)
    Handler function that extracts the transcript from a YouTube video by parsing the video ID from the input URL, fetching the transcript using YoutubeTranscript, joining the text parts, and returning it as text content.
    async ({ input }) => {
      const videoData = getVideoId(input);
      const output = await YoutubeTranscript.fetchTranscript(videoData.id as string).then((transcript: any) => {
        const text = transcript.map((t: any) => t.text).join(' ');
        return text;
      });
    
      return {
        content: [
          {
            type: "text",
            text: output,
          },
        ],
      };
    }
  • Zod schema defining the input as a string representing a YouTube video URL.
    {
      input: z.string().describe("a youtube video url"),
    },
  • index.ts:14-36 (registration)
    Registers the 'youtube-transcript-extractor' tool with the MCP server, including name, description, input schema, and handler function.
    server.tool(
      "youtube-transcript-extractor",
      "Extracts the transcript of a YouTube video.",
      {
        input: z.string().describe("a youtube video url"),
      },
      async ({ input }) => {
        const videoData = getVideoId(input);
        const output = await YoutubeTranscript.fetchTranscript(videoData.id as string).then((transcript: any) => {
          const text = transcript.map((t: any) => t.text).join(' ');
          return text;
        });
    
        return {
          content: [
            {
              type: "text",
              text: output,
            },
          ],
        };
      }
    );
Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/MalikElate/yt-description-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server