YouTube Summarizer Skill
Automatically fetch transcripts from YouTube videos, generate structured summaries, and deliver full transcripts to messaging platforms.
When to Use
Activate this skill when:
- - User shares a YouTube URL (youtube.com/watch, youtu.be, youtube.com/shorts)
- User asks to summarize or transcribe a YouTube video
- User requests information about a YouTube video's content
Dependencies
Required: MCP YouTube Transcript server must be installed at:
INLINECODE0
If not present, install it:
CODEBLOCK0
Workflow
1. Detect YouTube URL
Extract video ID from these patterns:
- - INLINECODE1
- INLINECODE2
- INLINECODE3
- Direct video ID:
VIDEO_ID (11 characters)
2. Fetch Transcript
Run this command to get the transcript:
CODEBLOCK1
Replace VIDEO_ID with the extracted ID. Read the output from /tmp/yt-transcript.json.
3. Process the Data
Parse the JSON to extract:
- -
result.metadata.title - Video title - INLINECODE8 - Channel name
- INLINECODE9 - Formatted view count
- INLINECODE10 - Publication date
- INLINECODE11 - Language used
- INLINECODE12 - Array of transcript segments
Full text: INLINECODE13
4. Generate Summary
Create a structured summary using this template:
CODEBLOCK2
Aim for:
- - Main thesis: 1-2 sentences maximum
- Key insights: 3-5 bullets, each 1-2 sentences
- Notable points: 2-4 supporting details
- Takeaway: Actionable conclusion
5. Save Full Transcript
Save the complete transcript to a timestamped file:
CODEBLOCK3
Include in the file:
- - Video metadata header
- Full transcript text
- URL reference
6. Platform-Specific Delivery
If channel is Telegram:
CODEBLOCK4
If channel is other/webchat:
Just reply with the summary (no file attachment).
7. Reply with Summary
Send the structured summary as your response to the user.
Error Handling
If transcript fetch fails:
- - Check if video has captions enabled
- Try with
lang: 'en' fallback if requested language unavailable - Inform user that transcript is not available and suggest alternatives:
- Manual YouTube transcript feature
- Video may not have captions
- Try a different video
If MCP server not installed:
- - Provide installation instructions
- Offer to install it automatically if in appropriate context
If video ID extraction fails:
- - Ask user to provide the full YouTube URL or video ID
Examples
See examples/ directory for sample outputs.
Quality Guidelines
- - Be concise: Summary should be scannable in 30 seconds
- Be accurate: Don't add information not in the transcript
- Be structured: Use consistent formatting for easy reading
- Be contextual: Adjust detail level based on video length
- Short videos (<5 min): Brief summary
- Long videos (>30 min): More detailed breakdown
Notes
- - MCP server uses Android client emulation to bypass YouTube's cloud IP blocking
- Works reliably from VPS/cloud environments where yt-dlp often fails
- Supports multiple languages with automatic fallback to English
- Transcript quality depends on YouTube's auto-generated captions or manual captions
YouTube 摘要技能
自动获取YouTube视频的字幕,生成结构化摘要,并将完整字幕发送到消息平台。
使用时机
在以下情况下激活此技能:
- - 用户分享YouTube链接(youtube.com/watch、youtu.be、youtube.com/shorts)
- 用户要求总结或转录YouTube视频
- 用户请求获取YouTube视频内容的相关信息
依赖项
必需: MCP YouTube Transcript服务器必须安装在以下路径:
/root/clawd/mcp-server-youtube-transcript
如果未安装,请执行以下命令:
bash
cd /root/clawd
git clone https://github.com/kimtaeyoon83/mcp-server-youtube-transcript.git
cd mcp-server-youtube-transcript
npm install && npm run build
工作流程
1. 检测YouTube链接
从以下格式中提取视频ID:
- - https://www.youtube.com/watch?v=VIDEOID
- https://youtu.be/VIDEOID
- https://www.youtube.com/shorts/VIDEOID
- 直接视频ID:VIDEOID(11个字符)
2. 获取字幕
运行以下命令获取字幕:
bash
cd /root/clawd/mcp-server-youtube-transcript && node --input-type=module -e
import { getSubtitles } from ./dist/youtube-fetcher.js;
const result = await getSubtitles({ videoID: VIDEO_ID, lang: en });
console.log(JSON.stringify(result, null, 2));
> /tmp/yt-transcript.json
将VIDEO_ID替换为提取到的ID。从/tmp/yt-transcript.json读取输出结果。
3. 处理数据
解析JSON以提取以下内容:
- - result.metadata.title - 视频标题
- result.metadata.author - 频道名称
- result.metadata.viewCount - 格式化后的观看次数
- result.metadata.publishDate - 发布日期
- result.actualLang - 使用的语言
- result.lines - 字幕片段数组
完整文本:result.lines.map(l => l.text).join( )
4. 生成摘要
使用以下模板创建结构化摘要:
markdown
📹 视频: [标题]
👤 频道: [作者] | 👁️ 观看: [观看次数] | 📅 发布时间: [日期]
🎯 核心论点:
[1-2句核心论点/信息]
💡 关键见解:
- - [见解1]
- [见解2]
- [见解3]
- [见解4]
- [见解5]
📝 重点内容:
🔑 要点总结:
[实际应用或结论]
目标要求:
- - 核心论点:最多1-2句话
- 关键见解:3-5条要点,每条1-2句话
- 重点内容:2-4个支撑细节
- 要点总结:可操作的结论
5. 保存完整字幕
将完整字幕保存到带时间戳的文件中:
/root/clawd/transcripts/YYYY-MM-DDVIDEOID.txt
文件中包含:
6. 按平台发送
如果频道是Telegram:
bash
message --action send --channel telegram --target CHAT_ID \
--filePath /root/clawd/transcripts/YYYY-MM-DDVIDEOID.txt \
--caption 📄 YouTube字幕:[标题]
如果频道是其他/网页聊天:
仅回复摘要(不附带文件)。
7. 回复摘要
将结构化摘要作为对用户的回复发送。
错误处理
如果获取字幕失败:
- - 检查视频是否启用了字幕
- 如果请求的语言不可用,尝试使用lang: en作为回退
- 告知用户字幕不可用,并提供替代方案:
- 手动使用YouTube字幕功能
- 视频可能没有字幕
- 尝试其他视频
如果MCP服务器未安装:
- - 提供安装说明
- 如果在适当的环境中,提供自动安装选项
如果视频ID提取失败:
- - 要求用户提供完整的YouTube链接或视频ID
示例
示例输出请参见examples/目录。
质量标准
- - 简洁明了: 摘要应在30秒内可浏览完毕
- 准确无误: 不添加字幕中未包含的信息
- 结构清晰: 使用一致的格式以便阅读
- 因地制宜: 根据视频长度调整详细程度
- 短视频(<5分钟):简要摘要
- 长视频(>30分钟):更详细的分解
备注
- - MCP服务器使用Android客户端模拟来绕过YouTube的云IP封锁
- 可在VPS/云环境中可靠运行,而yt-dlp在这些环境中经常失败
- 支持多种语言,自动回退到英语
- 字幕质量取决于YouTube的自动生成字幕或手动字幕