youtube-summarizer

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

youtube-summarizer

YouTube视频摘要工具

Purpose

用途

This skill extracts transcripts from YouTube videos and generates comprehensive, verbose summaries using the STAR + R-I-S-E framework. It validates video availability, extracts transcripts using the
youtube-transcript-api
Python library, and produces detailed documentation capturing all insights, arguments, and key points.
The skill is designed for users who need thorough content analysis and reference documentation from educational videos, lectures, tutorials, or informational content.
本技能可从YouTube视频中提取字幕,并使用STAR + R-I-S-E框架生成全面、详尽的摘要。它会验证视频可用性,借助
youtube-transcript-api
Python库提取字幕,并生成包含所有见解、论点和关键点的详细文档。
本技能专为需要对教育视频、讲座、教程或资讯类内容进行深度内容分析和参考文档整理的用户设计。

When to Use This Skill

适用场景

This skill should be used when:
  • User provides a YouTube video URL and wants a detailed summary
  • User needs to document video content for reference without rewatching
  • User wants to extract insights, key points, and arguments from educational content
  • User needs transcripts from YouTube videos for analysis
  • User asks to "summarize", "resume", or "extract content" from YouTube videos
  • User wants comprehensive documentation prioritizing completeness over brevity
在以下场景中可使用本技能:
  • 用户提供YouTube视频URL并需要详细摘要
  • 用户需要整理视频内容作为参考,无需重新观看
  • 用户希望从教育内容中提取见解、关键点和论点
  • 用户需要提取YouTube视频字幕用于分析
  • 用户要求对YouTube视频进行“总结”“提炼”或“提取内容”
  • 用户需要优先保证完整性而非简洁性的全面文档

Step 0: Discovery & Setup

步骤0:环境检测与配置

Before processing videos, validate the environment and dependencies:
bash
undefined
在处理视频前,需验证环境与依赖项:
bash
undefined

Check if youtube-transcript-api is installed

Check if youtube-transcript-api is installed

python3 -c "import youtube_transcript_api" 2>/dev/null if [ $? -ne 0 ]; then echo "⚠️ youtube-transcript-api not found" # Offer to install fi
python3 -c "import youtube_transcript_api" 2>/dev/null if [ $? -ne 0 ]; then echo "⚠️ youtube-transcript-api not found" # Offer to install fi

Check Python availability

Check Python availability

if ! command -v python3 &>/dev/null; then echo "❌ Python 3 is required but not installed" exit 1 fi

**Ask the user if dependency is missing:**
youtube-transcript-api is required but not installed.
Would you like to install it now?
  • Yes - Install with pip (pip install youtube-transcript-api)
  • No - I'll install it manually

**If user selects "Yes":**

```bash
pip install youtube-transcript-api
Verify installation:
bash
python3 -c "import youtube_transcript_api; print('✅ youtube-transcript-api installed successfully')"
if ! command -v python3 &>/dev/null; then echo "❌ Python 3 is required but not installed" exit 1 fi

**若依赖缺失,询问用户:**
youtube-transcript-api is required but not installed.
Would you like to install it now?
  • Yes - Install with pip (pip install youtube-transcript-api)
  • No - I'll install it manually

**若用户选择“Yes”:**

```bash
pip install youtube-transcript-api
验证安装:
bash
python3 -c "import youtube_transcript_api; print('✅ youtube-transcript-api installed successfully')"

Main Workflow

主工作流

Progress Tracking Guidelines

进度跟踪规范

Throughout the workflow, display a visual progress gauge before each step to keep the user informed. The gauge format is:
bash
echo "[████░░░░░░░░░░░░░░░░] 20% - Step 1/5: Validating URL"
Format specifications:
  • 20 characters wide (use █ for filled, ░ for empty)
  • Percentage increments: Step 1=20%, Step 2=40%, Step 3=60%, Step 4=80%, Step 5=100%
  • Step counter showing current/total (e.g., "Step 3/5")
  • Brief description of current phase
Display the initial status box before Step 1:
╔══════════════════════════════════════════════════════════════╗
║     📹  YOUTUBE SUMMARIZER - Processing Video                ║
╠══════════════════════════════════════════════════════════════╣
║ → Step 1: Validating URL                 [IN PROGRESS]       ║
║ ○ Step 2: Checking Availability                              ║
║ ○ Step 3: Extracting Transcript                              ║
║ ○ Step 4: Generating Summary                                 ║
║ ○ Step 5: Formatting Output                                  ║
╠══════════════════════════════════════════════════════════════╣
║ Progress: ██████░░░░░░░░░░░░░░░░░░░░░░░░  20%               ║
╚══════════════════════════════════════════════════════════════╝
在整个工作流中,每一步操作前需显示可视化进度条,让用户了解当前进度。进度条格式如下:
bash
echo "[████░░░░░░░░░░░░░░░░] 20% - Step 1/5: Validating URL"
格式说明:
  • 宽度为20个字符(用█表示已完成,░表示未完成)
  • 百分比递增:步骤1=20%,步骤2=40%,步骤3=60%,步骤4=80%,步骤5=100%
  • 步骤计数器显示当前/总步数(例如:"Step 3/5")
  • 显示当前阶段的简要描述
在步骤1前显示初始状态框:
╔══════════════════════════════════════════════════════════════╗
║     📹  YOUTUBE SUMMARIZER - Processing Video                ║
╠══════════════════════════════════════════════════════════════╣
║ → Step 1: Validating URL                 [IN PROGRESS]       ║
║ ○ Step 2: Checking Availability                              ║
║ ○ Step 3: Extracting Transcript                              ║
║ ○ Step 4: Generating Summary                                 ║
║ ○ Step 5: Formatting Output                                  ║
╠══════════════════════════════════════════════════════════════╣
║ Progress: ██████░░░░░░░░░░░░░░░░░░░░░░░░  20%               ║
╚══════════════════════════════════════════════════════════════╝

Step 1: Validate YouTube URL

步骤1:验证YouTube URL

Objective: Extract video ID and validate URL format.
Supported URL Formats:
  • https://www.youtube.com/watch?v=VIDEO_ID
  • https://youtube.com/watch?v=VIDEO_ID
  • https://youtu.be/VIDEO_ID
  • https://m.youtube.com/watch?v=VIDEO_ID
Actions:
bash
undefined
目标: 提取视频ID并验证URL格式。
支持的URL格式:
  • https://www.youtube.com/watch?v=VIDEO_ID
  • https://youtube.com/watch?v=VIDEO_ID
  • https://youtu.be/VIDEO_ID
  • https://m.youtube.com/watch?v=VIDEO_ID
操作:
bash
undefined

Extract video ID using regex or URL parsing

Extract video ID using regex or URL parsing

URL="$USER_PROVIDED_URL"
URL="$USER_PROVIDED_URL"

Pattern 1: youtube.com/watch?v=VIDEO_ID

Pattern 1: youtube.com/watch?v=VIDEO_ID

if echo "$URL" | grep -qE 'youtube.com/watch?v='; then VIDEO_ID=$(echo "$URL" | sed -E 's/.[?&]v=([^&]+)./\1/')
if echo "$URL" | grep -qE 'youtube.com/watch?v='; then VIDEO_ID=$(echo "$URL" | sed -E 's/.[?&]v=([^&]+)./\1/')

Pattern 2: youtu.be/VIDEO_ID

Pattern 2: youtu.be/VIDEO_ID

elif echo "$URL" | grep -qE 'youtu.be/'; then VIDEO_ID=$(echo "$URL" | sed -E 's/.youtu.be/([^?]+)./\1/') else echo "❌ Invalid YouTube URL format" exit 1 fi
echo "📹 Video ID extracted: $VIDEO_ID"

**If URL is invalid:**
❌ Invalid YouTube URL
Please provide a valid YouTube URL in one of these formats:
undefined
elif echo "$URL" | grep -qE 'youtu.be/'; then VIDEO_ID=$(echo "$URL" | sed -E 's/.youtu.be/([^?]+)./\1/') else echo "❌ Invalid YouTube URL format" exit 1 fi
echo "📹 Video ID extracted: $VIDEO_ID"

**若URL无效:**
❌ Invalid YouTube URL
Please provide a valid YouTube URL in one of these formats:
undefined

Step 2: Check Video & Transcript Availability

步骤2:检查视频与字幕可用性

Progress:
bash
echo "[████████░░░░░░░░░░░░] 40% - Step 2/5: Checking Availability"
Objective: Verify video exists and transcript is accessible.
Actions:
python
from youtube_transcript_api import YouTubeTranscriptApi, TranscriptsDisabled, NoTranscriptFound
import sys

video_id = sys.argv[1]

try:
    # Get list of available transcripts
    transcript_list = YouTubeTranscriptApi.list_transcripts(video_id)
    
    print(f"✅ Video accessible: {video_id}")
    print("📝 Available transcripts:")
    
    for transcript in transcript_list:
        print(f"  - {transcript.language} ({transcript.language_code})")
        if transcript.is_generated:
            print("    [Auto-generated]")
    
except TranscriptsDisabled:
    print(f"❌ Transcripts are disabled for video {video_id}")
    sys.exit(1)
    
except NoTranscriptFound:
    print(f"❌ No transcript found for video {video_id}")
    sys.exit(1)
    
except Exception as e:
    print(f"❌ Error accessing video: {e}")
    sys.exit(1)
Error Handling:
ErrorMessageAction
Video not found"❌ Video does not exist or is private"Ask user to verify URL
Transcripts disabled"❌ Transcripts are disabled for this video"Cannot proceed
No transcript available"❌ No transcript found (not auto-generated or manually added)"Cannot proceed
Private/restricted video"❌ Video is private or restricted"Ask for public video
进度:
bash
echo "[████████░░░░░░░░░░░░] 40% - Step 2/5: Checking Availability"
目标: 验证视频是否存在以及字幕是否可访问。
操作:
python
from youtube_transcript_api import YouTubeTranscriptApi, TranscriptsDisabled, NoTranscriptFound
import sys

video_id = sys.argv[1]

try:
    # Get list of available transcripts
    transcript_list = YouTubeTranscriptApi.list_transcripts(video_id)
    
    print(f"✅ Video accessible: {video_id}")
    print("📝 Available transcripts:")
    
    for transcript in transcript_list:
        print(f"  - {transcript.language} ({transcript.language_code})")
        if transcript.is_generated:
            print("    [Auto-generated]")
    
except TranscriptsDisabled:
    print(f"❌ Transcripts are disabled for video {video_id}")
    sys.exit(1)
    
except NoTranscriptFound:
    print(f"❌ No transcript found for video {video_id}")
    sys.exit(1)
    
except Exception as e:
    print(f"❌ Error accessing video: {e}")
    sys.exit(1)
错误处理:
错误类型提示信息操作
视频不存在"❌ Video does not exist or is private"请用户验证URL
字幕已禁用"❌ Transcripts are disabled for this video"无法继续处理
无可用字幕"❌ No transcript found (not auto-generated or manually added)"无法继续处理
私密/受限视频"❌ Video is private or restricted"请求用户提供公开视频

Step 3: Extract Transcript

步骤3:提取字幕

Progress:
bash
echo "[████████████░░░░░░░░] 60% - Step 3/5: Extracting Transcript"
Objective: Retrieve transcript in preferred language.
Actions:
python
from youtube_transcript_api import YouTubeTranscriptApi

video_id = "VIDEO_ID"

try:
    # Try to get transcript in user's preferred language first
    # Fall back to English if not available
    transcript = YouTubeTranscriptApi.get_transcript(
        video_id, 
        languages=['pt', 'en']  # Prefer Portuguese, fallback to English
    )
    
    # Combine transcript segments into full text
    full_text = " ".join([entry['text'] for entry in transcript])
    
    # Get video metadata
    from youtube_transcript_api import YouTubeTranscriptApi
    transcript_list = YouTubeTranscriptApi.list_transcripts(video_id)
    
    print("✅ Transcript extracted successfully")
    print(f"📊 Transcript length: {len(full_text)} characters")
    
    # Save to temporary file for processing
    with open(f"/tmp/transcript_{video_id}.txt", "w") as f:
        f.write(full_text)
    
except Exception as e:
    print(f"❌ Error extracting transcript: {e}")
    exit(1)
Transcript Processing:
  • Combine all transcript segments into coherent text
  • Preserve punctuation and formatting where available
  • Remove duplicate or overlapping segments (if auto-generated artifacts)
  • Store in temporary file for analysis
进度:
bash
echo "[████████████░░░░░░░░] 60% - Step 3/5: Extracting Transcript"
目标: 获取用户首选语言的字幕。
操作:
python
from youtube_transcript_api import YouTubeTranscriptApi

video_id = "VIDEO_ID"

try:
    # Try to get transcript in user's preferred language first
    # Fall back to English if not available
    transcript = YouTubeTranscriptApi.get_transcript(
        video_id, 
        languages=['pt', 'en']  # Prefer Portuguese, fallback to English
    )
    
    # Combine transcript segments into full text
    full_text = " ".join([entry['text'] for entry in transcript])
    
    # Get video metadata
    from youtube_transcript_api import YouTubeTranscriptApi
    transcript_list = YouTubeTranscriptApi.list_transcripts(video_id)
    
    print("✅ Transcript extracted successfully")
    print(f"📊 Transcript length: {len(full_text)} characters")
    
    # Save to temporary file for processing
    with open(f"/tmp/transcript_{video_id}.txt", "w") as f:
        f.write(full_text)
    
except Exception as e:
    print(f"❌ Error extracting transcript: {e}")
    exit(1)
字幕处理:
  • 将所有字幕片段合并为连贯文本
  • 尽可能保留标点和格式
  • 移除重复或重叠的片段(若为自动生成字幕的瑕疵)
  • 存储到临时文件以备分析

Step 4: Generate Comprehensive Summary

步骤4:生成全面摘要

Progress:
bash
echo "[████████████████░░░░] 80% - Step 4/5: Generating Summary"
Objective: Apply enhanced STAR + R-I-S-E prompt to create detailed summary.
Prompt Applied:
Use the enhanced prompt from Phase 2 (STAR + R-I-S-E framework) with the extracted transcript as input.
Actions:
  1. Load the full transcript text
  2. Apply the comprehensive summarization prompt
  3. Use AI model (Claude/GPT) to generate structured summary
  4. Ensure output follows the defined structure:
    • Header with video metadata
    • Executive synthesis
    • Detailed section-by-section breakdown
    • Key insights and conclusions
    • Concepts and terminology
    • Resources and references
Implementation:
bash
undefined
进度:
bash
echo "[████████████████░░░░] 80% - Step 4/5: Generating Summary"
目标: 应用增强版STAR + R-I-S-E提示词生成详细摘要。
使用的提示词:
使用第二阶段的增强版提示词(STAR + R-I-S-E框架),以提取的字幕作为输入。
操作:
  1. 加载完整的字幕文本
  2. 应用全面摘要提示词
  3. 使用AI模型(Claude/GPT)生成结构化摘要
  4. 确保输出遵循以下结构:
    • 包含视频元数据的标题
    • 执行摘要
    • 分节详细拆解
    • 关键见解与结论
    • 概念与术语
    • 资源与参考资料
实现方式:
bash
undefined

Use the transcript file as input to the AI prompt

Use the transcript file as input to the AI prompt

TRANSCRIPT_FILE="/tmp/transcript_${VIDEO_ID}.txt"
TRANSCRIPT_FILE="/tmp/transcript_${VIDEO_ID}.txt"

The AI agent will:

The AI agent will:

1. Read the transcript

1. Read the transcript

2. Apply the STAR + R-I-S-E summarization framework

2. Apply the STAR + R-I-S-E summarization framework

3. Generate comprehensive Markdown output

3. Generate comprehensive Markdown output

4. Structure with headers, lists, and highlights

4. Structure with headers, lists, and highlights

Read "$TRANSCRIPT_FILE" # Read transcript into context

Then apply the full summarization prompt (from enhanced version in Phase 2).
Read "$TRANSCRIPT_FILE" # Read transcript into context

然后应用第二阶段增强版的完整摘要提示词。

Step 5: Format and Present Output

步骤5:格式化并呈现输出

Progress:
bash
echo "[████████████████████] 100% - Step 5/5: Formatting Output"
Objective: Deliver the summary in clean, well-structured Markdown.
Output Structure:
markdown
undefined
进度:
bash
echo "[████████████████████] 100% - Step 5/5: Formatting Output"
目标: 以清晰、结构良好的Markdown格式交付摘要。
输出结构:
markdown
undefined

[Video Title]

[Video Title]

Canal: [Channel Name]
Duração: [Duration]
URL: [https://youtube.com/watch?v=VIDEO_ID]
Data de Publicação: [Date if available]
Canal: [Channel Name]
Duração: [Duration]
URL: [https://youtube.com/watch?v=VIDEO_ID]
Data de Publicação: [Date if available]

📝 Detailed Summary

📝 Detailed Summary

[Topic 1]

[Topic 1]

[Comprehensive explanation with examples, data, quotes...]
[Comprehensive explanation with examples, data, quotes...]

[Subtopic 1.1]

[Subtopic 1.1]

[Detailed breakdown...]
[Detailed breakdown...]

[Topic 2]

[Topic 2]

[Continued detailed analysis...]
[Continued detailed analysis...]

📚 Concepts and Terminology

📚 Concepts and Terminology

  • [Term 1]: [Definition and context]
  • [Term 2]: [Definition and context]
  • [Term 1]: [Definition and context]
  • [Term 2]: [Definition and context]

📌 Conclusion

📌 Conclusion

[Final synthesis and takeaways]
[Final synthesis and takeaways]

Example 2: Missing Dependency

Example 2: Missing Dependency

User Input:
claude> summarize this youtube video https://youtu.be/abc123
Skill Response:
⚠️  youtube-transcript-api not installed

This skill requires the Python library 'youtube-transcript-api'.

Would you like me to install it now?
- [ ] Yes - Install with pip
- [ ] No - I'll install manually
User selects "Yes":
bash
$ pip install youtube-transcript-api
Successfully installed youtube-transcript-api-0.6.1

✅ Installation complete! Proceeding with video summary...
User Input:
claude> summarize this youtube video https://youtu.be/abc123
Skill Response:
⚠️  youtube-transcript-api not installed

This skill requires the Python library 'youtube-transcript-api'.

Would you like me to install it now?
- [ ] Yes - Install with pip
- [ ] No - I'll install manually

Example 4: Invalid URL

Example 4: Invalid URL

User Input:
claude> summarize youtube video www.youtube.com/some-video
Skill Response:
❌ Invalid YouTube URL format

Expected format examples:
- https://www.youtube.com/watch?v=VIDEO_ID
- https://youtu.be/VIDEO_ID

Please provide a valid YouTube video URL.
User Input:
claude> summarize youtube video www.youtube.com/some-video
Skill Response:
❌ Invalid YouTube URL format

Expected format examples:
- https://www.youtube.com/watch?v=VIDEO_ID
- https://youtu.be/VIDEO_ID

Please provide a valid YouTube video URL.

📊 Executive Summary

📊 Executive Summary

This video provides a comprehensive introduction to the fundamental concepts of Artificial Intelligence (AI), designed for beginners and professionals who want to understand the technical foundations and practical applications of modern AI. The instructor covers everything from basic definitions to machine learning algorithms, using practical examples and visualizations to facilitate understanding.
[... continued detailed summary ...]

**Save Options:**
What would you like to save? → Summary + raw transcript
✅ File saved: resumo-exemplo123-2026-02-01.md (includes raw transcript) [████████████████████] 100% - ✓ Processing complete!


Welcome to this comprehensive tutorial on machine learning fundamentals. In today's video, we'll explore the core concepts that power modern AI systems...
Version: 1.2.0 Last Updated: 2026-02-02 Maintained By: Eric Andrade
This video provides a comprehensive introduction to the fundamental concepts of Artificial Intelligence (AI), designed for beginners and professionals who want to understand the technical foundations and practical applications of modern AI. The instructor covers everything from basic definitions to machine learning algorithms, using practical examples and visualizations to facilitate understanding.
[... continued detailed summary ...]

**保存选项:**
What would you like to save? → Summary + raw transcript
✅ File saved: resumo-exemplo123-2026-02-01.md (includes raw transcript) [████████████████████] 100% - ✓ Processing complete!


Welcome to this comprehensive tutorial on machine learning fundamentals. In today's video, we'll explore the core concepts that power modern AI systems...
Version: 1.2.0 Last Updated: 2026-02-02 Maintained By: Eric Andrade