Toolpal

@toolpal/youtube-transcript

public

v2.0published 1 download this weekMIT

Fetches the transcript, timestamped segments, chapters, and video metadata (title, channel, duration, publish date, available languages) from a public YouTube URL or video ID, and saves the transcript as a .txt, .md, .srt, or .vtt file. No API key needed.

Example

Verified from build

Real input and sandbox-captured output from this version.

Fetch a timestamped transcript

Input
{
  "video": "https://www.youtube.com/watch?v=jNQXAC9IVRw",
  "format": "timestamped"
}
OutputSandbox run
Output file:me-at-the-zoo.txt266 B · text/plain
{
  "url": "https://www.youtube.com/watch?v=jNQXAC9IVRw",
  "file": "me-at-the-zoo.txt",
  "title": "Me at the zoo",
  "channel": "jawed",
  "videoId": "jNQXAC9IVRw",
  "chapters": [
    {
      "start": 0,
      "title": "Intro",
      "timestamp": "00:00"
    },
    {
      "start": 5,
      "title": "The cool thing",
      "timestamp": "00:05"
    },
    {
      "start": 17,
      "title": "End",
      "timestamp": "00:17"
    }
  ],
  "language": "en",
  "segments": [
    {
      "text": "All right, so here we are, in front of the elephants",
      "start": 1.2,
      "duration": 2.16
    },
    {
      "text": "the cool thing about these guys is that they have really...",
      "start": 5.32,
      "duration": 2.66
    },
    {
      "text": "really really long trunks",
      "start": 7.97,
      "duration": 4.64
    },
    {
      "text": "and that's cool",
      "start": 12.62,
      "duration": 1.75
    },
    {
      "text": "(baaaaaaaaaaahhh!!)",
      "start": 14.42,
      "duration": 1.31
    },
    {
      "text": "and that's pretty much all there is to say",
      "start": 16.88,
      "duration": 2
    }
  ],
  "wordCount": 39,
  "transcript": "All right, so here we are, in front of the elephants the cool thing about these guys is that they have really... really really long trunks and that's cool (baaaaaaaaaaahhh!!) and that's pretty much all there is to say",
  "publishDate": "2005-04-23T20:31:52-07:00",
  "durationSeconds": 19,
  "isAutoGenerated": false,
  "availableLanguages": [
    {
      "code": "en",
      "name": "English",
      "isAutoGenerated": false
    },
    {
      "code": "de",
      "name": "German",
      "isAutoGenerated": false
    }
  ]
}

Fetches the transcript, timestamps, chapters, and metadata for any public YouTube video — with no API key required.

How it works

  1. Accepts any YouTube URL (watch?v=..., youtu.be/..., /shorts/..., /live/..., /embed/...) or a bare 11-character video ID.
  2. Fetches video metadata, description chapters, and available caption tracks via YouTube's InnerTube player endpoint.
  3. Picks your preferred language (preferring human-authored captions over auto-generated ones) and optionally translates captions via translateTo.
  4. Returns structured metadata, chapters, full plain-text transcript, timestamped segments, and writes a ready-to-use file (.txt, .md, .srt, or .vtt).

Example

{
  "video": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
  "language": "en",
  "format": "timestamped"
}

Notes

  • Requires no API key or environment variables (net: true to YouTube).
  • Works with any public video that has manual or auto-generated captions enabled.
  • Output files (.txt, .md, .srt, .vtt) can be passed directly into @toolpal/meeting-notes or @toolpal/translate-document.

Input

Validated before the workflow runs.

  • videorequiredstring

    YouTube URL (watch, youtu.be, shorts, live, embed) or 11-character video ID

    min length 11 · max length 300

  • format"text" | "timestamped" | "markdown" | "srt" | "vtt"

    Output file format; timestamped by default

  • languagestring

    Preferred caption language code, e.g. "en", "es", "hi"; defaults to English or first available

    max length 16

  • translateTostring

    Optional target language code for YouTube auto-translation, e.g. "en", "fr"

    max length 16

  • includeSegmentsboolean

    Include the per-line timestamped segments array in JSON output; default true

JSON Schema
{
  "type": "object",
  "required": [
    "video"
  ],
  "properties": {
    "video": {
      "type": "string",
      "maxLength": 300,
      "minLength": 11,
      "description": "YouTube URL (watch, youtu.be, shorts, live, embed) or 11-character video ID"
    },
    "format": {
      "anyOf": [
        {
          "type": "string",
          "const": "text"
        },
        {
          "type": "string",
          "const": "timestamped"
        },
        {
          "type": "string",
          "const": "markdown"
        },
        {
          "type": "string",
          "const": "srt"
        },
        {
          "type": "string",
          "const": "vtt"
        }
      ],
      "description": "Output file format; timestamped by default"
    },
    "language": {
      "type": "string",
      "maxLength": 16,
      "description": "Preferred caption language code, e.g. \"en\", \"es\", \"hi\"; defaults to English or first available"
    },
    "translateTo": {
      "type": "string",
      "maxLength": 16,
      "description": "Optional target language code for YouTube auto-translation, e.g. \"en\", \"fr\""
    },
    "includeSegments": {
      "type": "boolean",
      "description": "Include the per-line timestamped segments array in JSON output; default true"
    }
  }
}

Output

Validated before your agent receives it.

  • urlrequiredstring
  • filerequiredfile

    Saved transcript file (.txt, .md, .srt, or .vtt)

  • titlerequiredstring
  • channelrequiredstring
  • videoIdrequiredstring
  • chaptersrequiredobject[]
  • languagerequiredstring
  • segmentsobject[]
  • wordCountrequiredinteger
  • transcriptrequiredstring

    Full plain-text transcript

  • publishDatestring
  • durationSecondsrequiredinteger
  • isAutoGeneratedrequiredboolean
  • availableLanguagesrequiredobject[]
JSON Schema
{
  "type": "object",
  "required": [
    "videoId",
    "url",
    "title",
    "channel",
    "durationSeconds",
    "language",
    "isAutoGenerated",
    "availableLanguages",
    "chapters",
    "wordCount",
    "transcript",
    "file"
  ],
  "properties": {
    "url": {
      "type": "string"
    },
    "file": {
      "type": "string",
      "description": "Saved transcript file (.txt, .md, .srt, or .vtt)",
      "x-toolpal-file": true
    },
    "title": {
      "type": "string"
    },
    "channel": {
      "type": "string"
    },
    "videoId": {
      "type": "string"
    },
    "chapters": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "start",
          "timestamp",
          "title"
        ],
        "properties": {
          "start": {
            "type": "integer"
          },
          "title": {
            "type": "string"
          },
          "timestamp": {
            "type": "string"
          }
        }
      }
    },
    "language": {
      "type": "string"
    },
    "segments": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "start",
          "duration",
          "text"
        ],
        "properties": {
          "text": {
            "type": "string"
          },
          "start": {
            "type": "number"
          },
          "duration": {
            "type": "number"
          }
        }
      }
    },
    "wordCount": {
      "type": "integer"
    },
    "transcript": {
      "type": "string",
      "description": "Full plain-text transcript"
    },
    "publishDate": {
      "type": "string"
    },
    "durationSeconds": {
      "type": "integer"
    },
    "isAutoGenerated": {
      "type": "boolean"
    },
    "availableLanguages": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "code",
          "name",
          "isAutoGenerated"
        ],
        "properties": {
          "code": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "isAutoGenerated": {
            "type": "boolean"
          }
        }
      }
    }
  }
}