Skip to main content
Glama

youtube-transcript-extractor

Extract the transcript from any YouTube video by providing the video URL. Enables AI systems to analyze and process video content directly for insights and workflow integration.

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 video ID from the input URL, fetches the transcript using the YoutubeTranscript library, joins all transcript text segments into a single string, and returns it formatted as MCP 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 tool's input parameter 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, providing 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, }, ], }; } );
  • index.ts:3-4 (helper)
    Imports helper libraries: 'youtube-transcript' for fetching transcripts and 'get-video-id' for extracting video IDs from URLs.
    import { YoutubeTranscript } from 'youtube-transcript'; import getVideoId from 'get-video-id';

Other Tools

Related 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