Overview
This node fetches YouTube video subtitles (transcripts) with support for specifying the language and handling restricted videos via cookie-based authentication. It uses the external tool yt-dlp to download subtitles and optionally video metadata. The node can prefer manual subtitles over auto-generated ones, supports multiple output formats, and can include detailed video metadata.
Common scenarios where this node is useful include:
- Extracting transcripts for analysis, captioning, or translation workflows.
- Archiving subtitles in structured or plain text form.
- Processing videos that require authentication using cookies.
- Enriching data pipelines with video metadata alongside transcripts.
Practical example: A user wants to extract English subtitles from a public YouTube video as structured timestamped segments for further natural language processing. Another example is fetching both subtitles and metadata from a private video by providing a cookie string for authentication.
Properties
| Name | Meaning |
|---|---|
| Video ID/URL | The YouTube video identifier or full URL to the video. |
| Language | Language code of the desired transcript (e.g., "en", "vi", "fr", "es"). |
| Prefer Manual Subtitles | Whether to prioritize manually created subtitles over auto-generated ones. |
| Output Format | Format of the transcript output: "Structured" (array with timestamps), "Plain Text" (concatenated text), or "Both". |
| Include Metadata | Whether to include video metadata such as title, duration, uploader, upload date, view count, description, thumbnail, tags, and categories. |
| Binary Path | File path or command name for the yt-dlp binary (default "yt-dlp" assumes global installation). |
| Authentication Method | Method to authenticate for restricted videos: None, Cookie String, or Cookie File. |
| Cookie String | Cookie string exported from browser for authentication (shown only if "Cookie String" auth method selected). |
| Cookie File Path | Absolute path to a cookie file for authentication (shown only if "Cookie File" auth method selected). |
Output
The node outputs an array of items, each containing a JSON object with the following structure:
youtubeId: The extracted YouTube video ID.videoUrl: Normalized full YouTube video URL.language: Language code of the transcript.subtitleType: Either"manual"or"auto-generated"depending on subtitle source.transcriptLength: Number of transcript segments.transcript: (if output format includes structured) An array of transcript items, each with:text: Subtitle text segment.start: Start time in seconds (float).duration: Duration in seconds (float).
transcriptText: (if output format includes plain text) Concatenated subtitle text without timestamps.metadata: (optional, if enabled) Object containing video metadata fields:title,duration,uploader,uploadDate,viewCount,description,thumbnail,tags,categories.
If the node encounters errors per item and "Continue On Fail" is enabled, it outputs an error message and the video ID in the JSON.
No binary data output is produced by this node.
Dependencies
- Requires the external command-line tool
yt-dlpinstalled and accessible via the specified binary path. - For restricted videos, requires either a valid cookie string or cookie file for authentication.
- Uses temporary files in the OS temp directory for storing cookies and downloaded subtitles.
- No internal n8n credentials are required beyond user-provided cookie data if needed.
Troubleshooting
- yt-dlp not found or fails to run: The node throws an error indicating the
yt-dlpbinary was not found or failed. Ensureyt-dlpis installed and the binary path parameter is correct. - Empty Video ID/URL: The node will error if the video ID or URL input is empty.
- No transcript found: If no subtitles exist for the requested language, the node reports available languages. Check the language code or try another language.
- Failed to fetch video metadata: Could indicate network issues, invalid cookies, or video restrictions.
- Could not read transcript file: Indicates failure in downloading or parsing subtitles; verify permissions and yt-dlp functionality.
- Cookie handling: When using cookie strings, temporary files are created and deleted automatically. Failure to write or delete these files may cause errors.
To resolve most issues:
- Verify
yt-dlpinstallation and accessibility. - Confirm video ID/URL correctness.
- Use valid language codes.
- Provide correct cookie data for restricted videos.
- Enable "Continue On Fail" to handle partial failures gracefully.
Links and References
- yt-dlp GitHub Repository – Official repository for the yt-dlp downloader tool.
- YouTube Captions & Subtitles – YouTube help page about captions.
- N8N Documentation – General documentation for creating and using nodes in n8n.