YouTube Full Channel Transcripts
Free, local alternative to Apify actor — no third-party paid APIs.
Fetches all videos from a YouTube channel (or playlist), extracts available transcripts (auto-generated or manual), and exports to JSON/CSV.
When to Use
- - "Get all transcripts from channel X"
- "Export channel Y's video subtitles"
- "Build dataset of all videos from creator Z"
Prerequisites
- -
yt-dlp installed (https://github.com/yt-dlp/yt-dlp) - INLINECODE1 installed (for JSON processing)
- Internet connection
Usage
CODEBLOCK0
Options
| Parameter | Type | Required | Description |
|---|
| INLINECODE2 | string | yes | YouTube channel URL, handle, or playlist URL |
| INLINECODE3 |
string | no | Output format:
json (default) or
csv |
|
max_videos | integer | no | Limit number of videos to process (default: all) |
|
languages | string | no | Comma-separated language codes (e.g.,
en,es). Default:
en |
|
include_auto_generated | boolean | no | Include auto-generated transcripts? (default:
true) |
|
output_dir | string | no | Directory to save results (default:
workspace/exports/youtube-transcripts) |
Output
- -
transcripts.json or transcripts.csv — structured data with:
{
"video_id": "abc123",
"title": "Video Title",
"url": "https://youtube.com/watch?v=abc123",
"upload_date": "20240322",
"duration": 360,
"language": "en",
"transcript": "Full text...",
"is_auto_generated": false
}
- - Summary printed to console: number of videos processed, success/failure counts.
Implementation Details
- 1. Discovery:
yt-dlp --flat-playlist -J to list all videos - Transcript fetch:
yt-dlp --write-subs --sub-format srt --skip-download per video - Parsing: Extract SRT subtitles and convert to plain text
- Combine: Aggregate results into JSON/CSV
Errors & Retries
- - If a video has no available transcript, it's skipped (logged)
- Network errors: retry up to 3 times with backoff
- Rate limiting: yt-dlp handles automatically; can add
--sleep-interval if needed
Notes
- - Respect YouTube's rate limits. The tool includes small delays by default.
- Large channels (100+ videos) may take a while; use
max_videos to limit. - Auto-generated transcripts are more available but less accurate.
YouTube 全频道字幕
免费、本地的 Apify actor 替代方案——无需第三方付费 API。
获取 YouTube 频道(或播放列表)中的所有视频,提取可用的字幕(自动生成或手动添加),并导出为 JSON/CSV 格式。
适用场景
- - 获取 X 频道的所有字幕
- 导出 Y 频道的视频字幕
- 构建 Z 创作者所有视频的数据集
前置条件
- - 已安装 yt-dlp (https://github.com/yt-dlp/yt-dlp)
- 已安装 jq(用于 JSON 处理)
- 网络连接
使用方法
bash
基础:获取频道的所有字幕
youtube
fullchannel
transcripts channelurl=https://www.youtube.com/@SomeChannel output_format=json
带筛选条件
youtube
fullchannel
transcripts channelurl=https://www.youtube.com/c/ChannelName max
videos=50 languages=en includeauto_generated=true
选项
| 参数 | 类型 | 必填 | 描述 |
|---|
| channelurl | 字符串 | 是 | YouTube 频道 URL、句柄或播放列表 URL |
| outputformat |
字符串 | 否 | 输出格式:json(默认)或 csv |
| max_videos | 整数 | 否 | 限制处理的视频数量(默认:全部) |
| languages | 字符串 | 否 | 逗号分隔的语言代码(例如 en,es)。默认值:en |
| include
autogenerated | 布尔值 | 否 | 是否包含自动生成的字幕(默认:true) |
| output_dir | 字符串 | 否 | 结果保存目录(默认:workspace/exports/youtube-transcripts) |
输出
- - transcripts.json 或 transcripts.csv — 结构化数据,格式如下:
json
{
video_id: abc123,
title: 视频标题,
url: https://youtube.com/watch?v=abc123,
upload_date: 20240322,
duration: 360,
language: en,
transcript: 完整文本...,
is
autogenerated: false
}
- - 控制台输出摘要:处理的视频数量、成功/失败计数。
实现细节
- 1. 发现: 使用 yt-dlp --flat-playlist -J 列出所有视频
- 字幕获取: 每个视频使用 yt-dlp --write-subs --sub-format srt --skip-download
- 解析: 提取 SRT 字幕并转换为纯文本
- 合并: 将结果汇总为 JSON/CSV
错误与重试
- - 如果视频没有可用字幕,则跳过(记录日志)
- 网络错误:最多重试 3 次,带退避策略
- 速率限制:yt-dlp 自动处理;如有需要可添加 --sleep-interval
注意事项
- - 请遵守 YouTube 的速率限制。该工具默认包含小延迟。
- 大型频道(100+ 视频)可能需要较长时间;请使用 max_videos 限制数量。
- 自动生成的字幕更易获取但准确性较低。