YouTube Research & Transcription
Search YouTube, get video/channel info, and fetch transcripts using YouTube Data API v3.
Features
- - 📹 Video details (title, description, stats, publish date)
- 📝 Transcripts with timestamps
- 📺 Channel info and recent videos
- 🔍 Search within YouTube
- 🎬 Playlist info
Setup
1. Install dependencies
MCP Server (primary method):
CODEBLOCK0
Fallback tool (if MCP fails):
CODEBLOCK1
2. Get YouTube API Key
- 1. Go to Google Cloud Console
- Create/select a project (e.g., "YouTube Research")
- Enable the API:
- Menu → "APIs & Services" → "Library"
- Search: "YouTube Data API v3"
- Click "Enable"
- 4. Create credentials:
- "APIs & Services" → "Credentials"
- "Create Credentials" → "API Key"
- Copy the key
- 5. Optional - Restrict:
- Click the created key
- "API restrictions" → Select only "YouTube Data API v3"
- Save
3. Configure API Key
Option A: Clawdbot config (recommended)
Add to ~/.clawdbot/clawdbot.json:
CODEBLOCK2
Option B: Environment variable
CODEBLOCK3
4. Setup MCP Server
The skill will use mcporter to call the YouTube MCP server:
CODEBLOCK4
Usage
Search Videos
CODEBLOCK5
Returns video IDs, titles, descriptions, channel info.
Get Channel Info
CODEBLOCK6
List Recent Videos from Channel
CODEBLOCK7
Get Video Details
CODEBLOCK8
Get Transcript (Primary)
CODEBLOCK9
Get Transcript (Fallback with yt-dlp)
If MCP transcript fails (empty or unavailable), use yt-dlp:
CODEBLOCK10
Then read the .vtt file from /tmp/.
Or get transcript directly:
CODEBLOCK11
Common Workflows
1. Find Latest Episode from a Podcast
Example: Lex Fridman Podcast
CODEBLOCK12
Returns most recent video with title, ID, publish date.
2. Get Transcript for Research
CODEBLOCK13
3. Search for Topics
CODEBLOCK14
Filter results for relevant channels or dates.
Channel IDs Reference
Keep frequently used channels here for quick access:
- - Lex Fridman Podcast: INLINECODE5
- Indie Hackers: (add when needed)
- Laravel: (add when needed)
To find a channel ID:
- 1. Go to channel page
- View page source
- Search for
"channelId": or INLINECODE7
Or use search and extract from results.
API Quota Limits
YouTube Data API v3 has daily quotas:
- - Default: 10,000 units/day
- Search: 100 units per call
- Video details: 1 unit per call
- Transcript: 0 units (uses separate mechanism)
Tip: Use transcript lookups liberally (no quota cost), be conservative with search.
Troubleshooting
MCP Server Not Working
Symptom: Connection closed or INLINECODE9
Fix: Build from source:
CODEBLOCK15
Empty Transcripts
Symptom: Transcript returned but content is empty
Cause: Video may not have captions, or MCP can't access them
Fix: Use yt-dlp fallback (see above)
yt-dlp Not Found
CODEBLOCK16
Security Note
The YouTube API key is safe to use with this MCP server:
- - ✅ Key only used to authenticate with official YouTube Data API
- ✅ No third-party servers involved
- ✅ All network calls go to INLINECODE10
- ✅ Code reviewed (no data exfiltration)
However:
- - 🔒 Keep the key in Clawdbot config (not in code/scripts)
- 🔒 Restrict API key to YouTube Data API v3 only (in Google Cloud Console)
- 🔒 Don't commit the key to git repositories
Examples
Research Podcast for LinkedIn Post Ideas
CODEBLOCK17
Find Videos About a Trending Topic
CODEBLOCK18
Notes
- - MCP server path: INLINECODE11
- Always pass API key via environment: INLINECODE12
- Or set globally in shell/Clawdbot config
- Transcripts may be auto-generated (check accuracy for quotes)
- yt-dlp can also download audio if you need it (
--extract-audio --audio-format mp3)
YouTube 研究与转录
使用 YouTube Data API v3 搜索 YouTube、获取视频/频道信息以及获取转录文本。
功能特性
- - 📹 视频详情(标题、描述、统计数据、发布日期)
- 📝 带时间戳的转录文本
- 📺 频道信息和最新视频
- 🔍 在 YouTube 内搜索
- 🎬 播放列表信息
安装设置
1. 安装依赖
MCP 服务器(主要方式):
bash
npm install -g zubeid-youtube-mcp-server
备用工具(MCP 失败时使用):
bash
yt-dlp 用于提取转录文本
pip install yt-dlp
2. 获取 YouTube API 密钥
- 1. 前往 Google Cloud Console
- 创建/选择一个项目(例如:YouTube Research)
- 启用 API:
- 菜单 → API 和服务 → 库
- 搜索:YouTube Data API v3
- 点击启用
- 4. 创建凭据:
- API 和服务 → 凭据
- 创建凭据 → API 密钥
- 复制密钥
- 5. 可选 - 限制使用:
- 点击已创建的密钥
- API 限制 → 仅选择YouTube Data API v3
- 保存
3. 配置 API 密钥
选项 A:Clawdbot 配置(推荐)
添加到 ~/.clawdbot/clawdbot.json:
json
{
skills: {
entries: {
youtube: {
apiKey: AIzaSy...
}
}
}
}
选项 B:环境变量
bash
export YOUTUBEAPIKEY=AIzaSy...
4. 设置 MCP 服务器
该技能将使用 mcporter 调用 YouTube MCP 服务器:
bash
从源码构建(如果安装的包有问题)
cd /tmp
git clone https://github.com/ZubeidHendricks/youtube-mcp-server
cd youtube-mcp-server
npm install
npm run build
使用方法
搜索视频
bash
mcporter call --stdio node /tmp/youtube-mcp-server/dist/cli.js \
search_videos query=ClawdBot AI maxResults:5
返回视频 ID、标题、描述、频道信息。
获取频道信息
bash
mcporter call --stdio node /tmp/youtube-mcp-server/dist/cli.js \
channels_info channelId=UCSHZKyawb77ixDdsGog4iWA
列出频道最新视频
bash
mcporter call --stdio node /tmp/youtube-mcp-server/dist/cli.js \
channels_listVideos channelId=UCSHZKyawb77ixDdsGog4iWA maxResults:5
获取视频详情
bash
mcporter call --stdio node /tmp/youtube-mcp-server/dist/cli.js \
videos_details videoId=Z-FRe5AKmCU
获取转录文本(主要方式)
bash
mcporter call --stdio node /tmp/youtube-mcp-server/dist/cli.js \
transcripts_getTranscript videoId=Z-FRe5AKmCU
获取转录文本(使用 yt-dlp 备用)
如果 MCP 转录失败(为空或不可用),使用 yt-dlp:
bash
yt-dlp --skip-download --write-auto-sub --sub-lang en --sub-format vtt \
--output /tmp/%(id)s.%(ext)s \
https://youtube.com/watch?v=Z-FRe5AKmCU
然后从 /tmp/ 读取 .vtt 文件。
或直接获取转录文本:
bash
yt-dlp --skip-download --write-auto-sub --sub-lang en --print %(subtitles)s \
https://youtube.com/watch?v=VIDEO_ID 2>&1 | grep -A1000 WEBVTT
常见工作流程
1. 查找播客最新剧集
示例:Lex Fridman 播客
bash
获取频道 ID(Lex Fridman:UCSHZKyawb77ixDdsGog4iWA)
mcporter call --stdio node /tmp/youtube-mcp-server/dist/cli.js \
channels_listVideos channelId=UCSHZKyawb77ixDdsGog4iWA maxResults:1
返回最新视频,包含标题、ID、发布日期。
2. 获取研究用转录文本
bash
步骤 1:从搜索或频道列表获取视频 ID
步骤 2:先尝试 MCP 转录
mcporter call --stdio node /tmp/youtube-mcp-server/dist/cli.js \
transcripts
getTranscript videoId=VIDEOID
步骤 3:如果为空,使用 yt-dlp 备用
yt-dlp --skip-download --write-auto-sub --sub-lang en \
--output /tmp/%(id)s.%(ext)s \
https://youtube.com/watch?v=VIDEO_ID
cat /tmp/VIDEO_ID.en.vtt
3. 搜索主题
bash
mcporter call --stdio node /tmp/youtube-mcp-server/dist/cli.js \
search_videos query=Laravel AI productivity 2025 maxResults:10
筛选相关频道或日期的结果。
频道 ID 参考
在此保存常用频道以便快速访问:
- - Lex Fridman 播客: UCSHZKyawb77ixDdsGog4iWA
- Indie Hackers:(需要时添加)
- Laravel:(需要时添加)
查找频道 ID 的方法:
- 1. 进入频道页面
- 查看页面源代码
- 搜索 channelId: 或 externalId
或使用搜索功能并从结果中提取。
API 配额限制
YouTube Data API v3 有每日配额:
- - 默认:10,000 单位/天
- 搜索:每次调用 100 单位
- 视频详情:每次调用 1 单位
- 转录文本:0 单位(使用独立机制)
提示: 可大量使用转录文本查询(无配额成本),搜索功能需谨慎使用。
故障排除
MCP 服务器无法工作
症状: 连接已关闭 或 需要 YOUTUBEAPIKEY 环境变量
解决方法: 从源码构建:
bash
cd /tmp
git clone https://github.com/ZubeidHendricks/youtube-mcp-server
cd youtube-mcp-server
npm install
npm run build
测试
YOUTUBE
APIKEY=your_key node dist/cli.js
转录文本为空
症状: 返回了转录但内容为空
原因: 视频可能没有字幕,或 MCP 无法访问
解决方法: 使用 yt-dlp 备用方案(见上文)
yt-dlp 未找到
bash
pip install --user yt-dlp
或
pipx install yt-dlp
安全说明
YouTube API 密钥与此 MCP 服务器一起使用是安全的:
- - ✅ 密钥仅用于与官方 YouTube Data API 进行身份验证
- ✅ 不涉及第三方服务器
- ✅ 所有网络调用均指向 googleapis.com
- ✅ 代码已审查(无数据泄露)
然而:
- - 🔒 将密钥保存在 Clawdbot 配置中(不要放在代码/脚本中)
- 🔒 在 Google Cloud Console 中将 API 密钥限制为仅限 YouTube Data API v3
- 🔒 不要将密钥提交到 git 仓库
示例
研究播客以获取 LinkedIn 帖子灵感
bash
1. 查找最新的 Lex Fridman 剧集
mcporter call --stdio node /tmp/youtube-mcp-server/dist/cli.js \
channels_listVideos channelId=UCSHZKyawb77ixDdsGog4iWA maxResults:1
2. 获取视频详情
mcporter call --stdio node /tmp/youtube-mcp-server/dist/cli.js \
videos_details videoId=Z-FRe5AKmCU
3. 获取转录文本
mcporter call --stdio node /tmp/youtube-mcp-server/dist/cli.js \
transcripts_getTranscript videoId=Z-FRe5AKmCU
如果转录为空,使用 yt-dlp
yt-dlp --skip-download --write-auto-sub --sub-lang en \
--output /tmp/%(id)s.%(ext)s \
https://y