youtube-content
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseYouTube Content
YouTube 内容处理
Extract transcripts and metadata from YouTube videos for analysis.
提取YouTube视频的字幕文稿和元数据以进行分析。
Workflow
工作流程
- Extract video ID from URL
- Run fetch script from skill directory
- Present metadata summary to user
- Apply requested analysis mode to transcript
- Save analysis and raw transcript to knowledge base (auto, use to skip)
--no-save
- 从URL中提取视频ID
- 运行技能目录中的获取脚本
- 向用户展示元数据摘要
- 对字幕文稿应用请求的分析模式
- 将分析结果和原始字幕文稿保存到知识库(自动执行,使用参数可跳过)
--no-save
Fetch Script
获取脚本
Run from the skill directory ():
~/.claude/skills/youtube-content/bash
uv run ~/.claude/skills/youtube-content/scripts/fetch_youtube.py "https://youtube.com/watch?v=VIDEO_ID"Options:
- - Skip transcript extraction
--metadata-only - - Skip metadata extraction
--transcript-only - - Include timestamped segments (for quote extraction)
--with-segments
Output: JSON with
{video_id, metadata, transcript, errors}By default, transcript contains only and . Use when timestamps are needed (e.g., Quotes mode).
textlanguage--with-segments从技能目录()中运行:
~/.claude/skills/youtube-content/bash
uv run ~/.claude/skills/youtube-content/scripts/fetch_youtube.py "https://youtube.com/watch?v=VIDEO_ID"可选参数:
- - 跳过字幕文稿提取
--metadata-only - - 跳上元数据提取
--transcript-only - - 包含带时间戳的片段(用于语录提取)
--with-segments
输出格式:JSON,包含
{video_id, metadata, transcript, errors}默认情况下,字幕文稿仅包含和字段。当需要时间戳时(例如语录模式),请使用参数。
textlanguage--with-segmentsSupported URL Formats
支持的URL格式
youtube.com/watch?v=VIDEO_IDyoutu.be/VIDEO_IDyoutube.com/embed/VIDEO_IDyoutube.com/v/VIDEO_ID- Bare video ID (11 characters)
youtube.com/watch?v=VIDEO_IDyoutu.be/VIDEO_IDyoutube.com/embed/VIDEO_IDyoutube.com/v/VIDEO_ID- 纯视频ID(11个字符)
Analysis Modes
分析模式
Select based on user request:
| User Says | Mode | Action |
|---|---|---|
| "extract wisdom", "key insights" | Wisdom | See analysis-modes.md |
| "summarize", "TLDR", "overview" | Summary | See analysis-modes.md |
| "questions", "Q&A", "discussion" | Q&A | See analysis-modes.md |
| "quotes", "notable statements" | Quotes | Use |
| Other specific requests | Custom | Apply user's instructions directly |
根据用户请求选择对应模式:
| 用户需求 | 模式 | 操作 |
|---|---|---|
| "提取见解"、"关键洞察" | Wisdom(见解提取) | 查看analysis-modes.md |
| "总结"、"TLDR"、"概述" | Summary(内容总结) | 查看analysis-modes.md |
| "问题准备"、"问答"、"讨论素材" | Q&A(问答准备) | 查看analysis-modes.md |
| "语录"、"重要语句" | Quotes(语录提取) | 使用 |
| 其他特定请求 | Custom(自定义分析) | 直接应用用户的指令 |
Error Handling
错误处理
The script returns partial results when possible:
- Transcripts disabled: Returns metadata only, notes error
- Private video: Clear error message with video ID
- No transcript found: Returns metadata, suggests alternatives
- Rate limiting: Retry after 30-60 seconds
Check the array in output for any issues.
errors脚本会尽可能返回部分结果:
- 字幕已禁用:仅返回元数据,并标注错误
- 私有视频:返回包含视频ID的清晰错误提示
- 未找到字幕:返回元数据,并给出替代方案建议
- 请求受限:30-60秒后重试
可查看输出中的数组了解具体问题。
errorsBackground Analysis (Subagent)
后台分析(子Agent)
For video analysis that shouldn't block the main conversation, spawn a background subagent:
Task(
subagent_type: "general-purpose",
prompt: "Read ~/.claude/skills/youtube-content/SKILL.md and follow the workflow.
Analyze this YouTube video: {url}
Mode: {wisdom|summary|qa|quotes}
Save to knowledge base: {yes|no}"
)对于不应阻塞主对话的视频分析任务,可启动后台子Agent:
Task(
subagent_type: "general-purpose",
prompt: "Read ~/.claude/skills/youtube-content/SKILL.md and follow the workflow.
Analyze this YouTube video: {url}
Mode: {wisdom|summary|qa|quotes}
Save to knowledge base: {yes|no}"
)Knowledge Persistence
知识持久化
Analyses and raw transcripts are automatically saved to a knowledge base for future reference.
分析结果和原始字幕文稿会自动保存到知识库,以便后续参考。
Configuration
配置
Set to customize storage location (default: ).
CLAUDE_KNOWLEDGE_DIR~/.claude/knowledge设置可自定义存储位置(默认路径:)。
CLAUDE_KNOWLEDGE_DIR~/.claude/knowledgeSave Analysis
保存分析结果
Saves both the analysis (markdown) and raw transcript (JSON):
bash
echo '{"video_id": "...", "metadata": {...}, "transcript": {...}, "analysis": "..."}' | \
uv run scripts/save_analysis.py --mode wisdom --tags "ai,coding"Output:
{"saved": true, "analysis_path": "...", "transcript_path": "..."}同时保存分析结果(Markdown格式)和原始字幕文稿(JSON格式):
bash
echo '{"video_id": "...", "metadata": {...}, "transcript": {...}, "analysis": "..."}' | \
uv run scripts/save_analysis.py --mode wisdom --tags "ai,coding"输出:
{"saved": true, "analysis_path": "...", "transcript_path": "..."}Search Knowledge
搜索知识库
bash
uv run scripts/search_knowledge.py --list # List recent
uv run scripts/search_knowledge.py "react" # Search keyword
uv run scripts/search_knowledge.py --tag ai # Filter by tagbash
uv run scripts/search_knowledge.py --list # 列出最近的内容
uv run scripts/search_knowledge.py "react" # 按关键词搜索
uv run scripts/search_knowledge.py --tag ai # 按标签筛选File Structure
文件结构
$CLAUDE_KNOWLEDGE_DIR/youtube/
├── .gitignore # Ignores transcripts/
├── index.md # Quick reference
├── analyses/
│ └── 2025-12-30_VIDEO_ID.md # Formatted analysis with frontmatter
└── transcripts/ # Raw data (gitignored)
└── 2025-12-30_VIDEO_ID.json # Full fetch output with transcriptNote: Raw transcripts are gitignored by default as they can be large and re-fetched from YouTube if needed.
$CLAUDE_KNOWLEDGE_DIR/youtube/
├── .gitignore # 忽略transcripts/目录
├── index.md # 快速参考文档
├── analyses/
│ └── 2025-12-30_VIDEO_ID.md # 带前置信息的格式化分析结果
└── transcripts/ # 原始数据(已加入git忽略)
└── 2025-12-30_VIDEO_ID.json # 包含字幕的完整获取输出注意:原始字幕文稿默认被加入git忽略,因为它们可能体积较大,且可随时从YouTube重新获取。