YouTube Transcript icon

YouTube Transcript

Extract transcripts from YouTube videos with enhanced language priority

Overview

This node extracts transcripts from YouTube videos or retrieves basic video information. It is particularly useful for automating the process of obtaining subtitles or captions in various languages, which can then be used for content analysis, accessibility improvements, or AI processing.

Common scenarios include:

  • Generating searchable text from video content.
  • Creating summaries or structured data for AI agents.
  • Converting transcripts into subtitle formats like SRT or VTT.
  • Fetching metadata about a video such as title, author, and thumbnail.

For example, you could input a YouTube video URL to get its transcript in English with timestamps included, formatted as WebVTT for use in video players. Alternatively, you might retrieve video info to display alongside embedded videos in your application.

Properties

Name Meaning
Video URL The YouTube video URL or just the video ID to extract the transcript or video info from.
Language The language code for the transcript to retrieve. Options: Auto-Detect, Chinese (Simplified), Chinese (Traditional), English, French, German, Italian, Japanese, Korean, Portuguese, Russian, Spanish.
Additional Options A collection of optional settings:
- Include Timestamps Whether to include timestamps in the transcript output (true/false).
- Format Output The format of the transcript output. Options: Raw Text (plain text), Structured (with timestamps and text), SRT Format (SubRip subtitles), VTT Format (WebVTT subtitles).
- AI Agent Mode Optimize output format for AI agents; produces simplified and structured data (true/false).
- Include Summary When AI Agent Mode is enabled, whether to include a human-readable summary of the transcript (true/false).
- Max Length Maximum length of the transcript text in characters (range: 100 to 50,000).

Output

The node outputs JSON data with the following structure depending on the operation and options:

  • Get Transcript:

    • transcript: An array of segments, each containing text, start time, duration, and index (if structured output).
    • text (for raw output): Plain concatenated transcript text.
    • srt: Subtitle text in SubRip format (if selected).
    • vtt: Subtitle text in WebVTT format (if selected).
    • language: Language code of the transcript.
    • video_id: YouTube video ID.
    • segments_count: Number of transcript segments.
    • total_duration: Total duration covered by the transcript segments (seconds).
    • If AI Agent Mode is enabled, output includes:
      • full_text: Full transcript text.
      • word_count: Number of words in the transcript.
      • summary: Optional short summary of the transcript.
      • Other metadata useful for AI processing.
  • Get Video Info:

    • Basic video metadata such as title, author name, author URL, type, dimensions, provider info, thumbnail URLs, embed HTML, and video URL.

The node does not output binary data.

Dependencies

  • Requires internet access to call YouTube's public endpoints and internal APIs.
  • Uses Axios HTTP client internally for requests.
  • No special API keys or credentials are required since it scrapes publicly available data and uses YouTube's InnerTube API key extracted dynamically.
  • No environment variables or external n8n configurations needed beyond standard HTTP connectivity.

Troubleshooting

  • Invalid YouTube URL or Video ID: If the provided video URL or ID is malformed or cannot be parsed, the node throws an error indicating invalid input. Ensure the URL or ID is correct and matches YouTube's format.
  • No Transcript Found: Some videos may not have captions available in the requested language. The node attempts fallback languages but will error if no suitable transcript is found.
  • API Extraction Failures: The node tries multiple methods to extract transcripts. Network issues, changes in YouTube's API, or rate limiting may cause failures. Retrying later or verifying network access can help.
  • Transcript Too Long: The max length option limits transcript size. Setting this too low may truncate results unexpectedly.
  • AI Agent Mode Errors: If enabled but transcript data is missing or empty, the node returns an error object indicating no transcript data is available.

To resolve errors:

  • Verify video URL/ID correctness.
  • Check network connectivity.
  • Adjust language and max length options.
  • Disable AI Agent Mode if not needed.

Links and References

Discussion