简介
基于 YouTube Data API v3 与 yt-dlp 双引擎,提供视频搜索、频道分析及字幕转录服务,助力内容创作者与研究人员高效获取视频情报。
原始描述
Search YouTube videos, get channel info, fetch video details and transcripts using YouTube Data API v3 via MCP server or yt-dlp fallback.
通过你的 Agent 添加
点「快速安装」复制一段指令,粘给你正在用的 Agent(Claude Code、Codex、OpenClaw 等),它会自己完成安装。
或者手动安装
包里是 SKILL.md 加作者附带的文件,解压后目录名就是技能名。
技能申请的权限由作者决定,装之前请确认它能读什么、能执行什么。
中文使用说明 来自收录源
核心用法
该 Skill 提供了一套完整的 YouTube 内容获取解决方案,主要通过两种技术路径实现:主方案采用基于 MCP(Model Context Protocol)的 YouTube MCP Server,通过 mcporter 调用实现视频搜索、频道信息查询、视频详情获取及字幕提取;备选方案则使用开源工具 yt-dlp 直接下载视频字幕文件。用户需先配置 YouTube Data API v3 的访问密钥,即可通过命令行接口执行精准搜索、获取频道最新视频列表、提取带时间戳的字幕文本等操作。
显著优点
首先,双引擎冗余设计确保了字幕获取的高成功率,当 MCP Server 无法获取字幕时可无缝切换至 yt-dlp 方案。其次,官方 API 保障使得数据获取稳定可靠,且明确标注了 API 配额消耗规则(搜索 100 单位/次,视频详情 1 单位/次,字幕 0 单位),便于用户合理规划调用策略。再者,零代码文档型架构降低了使用门槛,纯 Markdown 文档配合示例命令,用户无需编写代码即可完成复杂操作。最后,完善的安全指南详细说明了 API Key 的保护措施,包括环境变量配置、权限限制建议及定期轮换策略。
潜在缺点或局限性
作为 T3 来源(个人开发者维护)的项目,其长期维护稳定性和代码审计深度不及企业级产品。功能上依赖外部 MCP Server(zubeid-youtube-mcp-server),若该依赖项停止维护或出现兼容性 issue,可能影响核心功能。用户需要自行申请并管理 Google Cloud API Key,过程涉及创建项目、启用 API、配置配额等步骤,对非技术用户有一定门槛。此外,字幕提取的准确性受限于 YouTube 自动生成的字幕质量,对于专业术语或口音较重的内容可能存在识别错误,不适合需要 100% 准确转录的法律或医疗场景。
适合的目标群体
本 Skill 特别适合内容创作者与营销人员,用于监控竞品频道、分析热门话题趋势及提取视频要点制作二次创作素材;学术研究人员可利用其批量获取教育视频字幕进行文本分析或语料库构建;播客与媒体工作者能够快速获取访谈类节目的文字稿,提升内容生产效率;此外,市场情报分析师可通过搜索特定关键词追踪行业动态,建立自动化的视频内容监控流程。
使用风险
配额限制风险:YouTube Data API 默认每日限额 10,000 单位,大规模自动化抓取可能快速耗尽配额导致服务中断。密钥安全风险:尽管文档提供了安全指南,但 API Key 一旦泄露可能被他人滥用,导致配额被盗用或触发 Google 安全策略。依赖可用性风险:yt-dlp 作为第三方工具,可能因 YouTube 的反爬策略更新而暂时失效;MCP Server 的 Node.js 环境配置也可能在不同操作系统上出现兼容性问题。数据合规风险:提取的字幕内容受版权保护,用户需确保使用场景符合 YouTube 服务条款及当地版权法规,避免未经授权的公开分发。
技能正文
name: youtube description: Search YouTube videos, get channel info, fetch video details and transcripts using YouTube Data API v3 via MCP server or yt-dlp fallback. metadata: {"clawdbot":{"emoji":"📹","requires":{"bins":["yt-dlp"],"npm":["zubeid-youtube-mcp-server"]},"primaryEnv":"YOUTUBE_API_KEY"}}
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):
npm install -g zubeid-youtube-mcp-server
Fallback tool (if MCP fails):
# yt-dlp for transcript extraction
pip install yt-dlp
2. Get YouTube API Key
- 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"
- Create credentials:
- "APIs & Services" → "Credentials"
- "Create Credentials" → "API Key"
- Copy the key
- 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:
{
"skills": {
"entries": {
"youtube": {
"apiKey": "AIzaSy..."
}
}
}
}
Option B: Environment variable
export YOUTUBE_API_KEY="AIzaSy..."
4. Setup MCP Server
The skill will use mcporter to call the YouTube MCP server:
# Build from source (if installed package has issues)
cd /tmp
git clone https://github.com/ZubeidHendricks/youtube-mcp-server
cd youtube-mcp-server
npm install
npm run build
Usage
Search Videos
mcporter call --stdio "node /tmp/youtube-mcp-server/dist/cli.js" \
search_videos query="ClawdBot AI" maxResults:5
Returns video IDs, titles, descriptions, channel info.
Get Channel Info
mcporter call --stdio "node /tmp/youtube-mcp-server/dist/cli.js" \
channels_info channelId="UCSHZKyawb77ixDdsGog4iWA"
List Recent Videos from Channel
mcporter call --stdio "node /tmp/youtube-mcp-server/dist/cli.js" \
channels_listVideos channelId="UCSHZKyawb77ixDdsGog4iWA" maxResults:5
Get Video Details
mcporter call --stdio "node /tmp/youtube-mcp-server/dist/cli.js" \
videos_details videoId="Z-FRe5AKmCU"
Get Transcript (Primary)
mcporter call --stdio "node /tmp/youtube-mcp-server/dist/cli.js" \
transcripts_getTranscript videoId="Z-FRe5AKmCU"
Get Transcript (Fallback with yt-dlp)
If MCP transcript fails (empty or unavailable), use yt-dlp:
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"
Then read the .vtt file from /tmp/.
Or get transcript directly:
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"
Common Workflows
1. Find Latest Episode from a Podcast
Example: Lex Fridman Podcast
# Get channel ID (Lex Fridman: UCSHZKyawb77ixDdsGog4iWA)
mcporter call --stdio "node /tmp/youtube-mcp-server/dist/cli.js" \
channels_listVideos channelId="UCSHZKyawb77ixDdsGog4iWA" maxResults:1
Returns most recent video with title, ID, publish date.
2. Get Transcript for Research
# Step 1: Get video ID from search or channel listing
# Step 2: Try MCP transcript first
mcporter call --stdio "node /tmp/youtube-mcp-server/dist/cli.js" \
transcripts_getTranscript videoId="VIDEO_ID"
# Step 3: If empty, fallback to 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. Search for Topics
mcporter call --stdio "node /tmp/youtube-mcp-server/dist/cli.js" \
search_videos query="Laravel AI productivity 2025" maxResults:10
Filter results for relevant channels or dates.
Channel IDs Reference
Keep frequently used channels here for quick access:
- Lex Fridman Podcast:
UCSHZKyawb77ixDdsGog4iWA - Indie Hackers: (add when needed)
- Laravel: (add when needed)
To find a channel ID:
- Go to channel page
- View page source
- Search for
"channelId":or"externalId"
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 YOUTUBE_API_KEY environment variable is required
Fix: Build from source:
cd /tmp
git clone https://github.com/ZubeidHendricks/youtube-mcp-server
cd youtube-mcp-server
npm install
npm run build
# Test
YOUTUBE_API_KEY="your_key" node dist/cli.js
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
pip install --user yt-dlp
# or
pipx install yt-dlp
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
googleapis.com - ✅ 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
# 1. Find latest Lex Fridman episode
mcporter call --stdio "node /tmp/youtube-mcp-server/dist/cli.js" \
channels_listVideos channelId="UCSHZKyawb77ixDdsGog4iWA" maxResults:1
# 2. Get video details
mcporter call --stdio "node /tmp/youtube-mcp-server/dist/cli.js" \
videos_details videoId="Z-FRe5AKmCU"
# 3. Get transcript
mcporter call --stdio "node /tmp/youtube-mcp-server/dist/cli.js" \
transcripts_getTranscript videoId="Z-FRe5AKmCU"
# If transcript empty, use yt-dlp
yt-dlp --skip-download --write-auto-sub --sub-lang en \
--output "/tmp/%(id)s.%(ext)s" \
"https://youtube.com/watch?v=Z-FRe5AKmCU"
# 4. Analyze transcript for interesting topics
# (read /tmp/Z-FRe5AKmCU.en.vtt and extract key themes)
Find Videos About a Trending Topic
# Search for recent videos
mcporter call --stdio "node /tmp/youtube-mcp-server/dist/cli.js" \
search_videos query="ClawdBot security concerns" maxResults:10
# Pick relevant ones, get transcripts
# Analyze sentiment and technical claims
Notes
- MCP server path:
/tmp/youtube-mcp-server/dist/cli.js - Always pass API key via environment:
YOUTUBE_API_KEY="key" node ... - 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)
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。