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.

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"
          }
        }
      }
    }
  }
}