Communitygithub.com

YouTube视频摘要生成器

从YouTube视频中提取转录文本,并使用智能分析框架生成全面、详细的摘要。

YouTube视频摘要生成器 是什么?

此AI技能专为需要从YouTube视频中提取并总结内容的用户设计。它能够自动验证视频URL的合法性,检查视频及转录文本的可用性,并使用 `youtube-transcript-api` Python库提取转录。技能的核心优势在于其采用了增强的STAR + R-I-S-E框架来生成结构化、详尽的摘要,确保不遗漏任何关键见解、论点和知识点。该摘要以Markdown格式呈现,包含视频元数据、执行摘要、逐节详细分析、关键概念术语表以及结论。该技能支持多种YouTube URL格式,并提供了完整的错误处理机制(如视频不存在、转录禁用等)。目前主要支持命令行或AI代理(如Claude)环境,并通过进度条和状态框提供清晰的用户体验。

兼容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/AlperTuncOrtak/crypto-data-pipeline/tree/HEAD/skills/youtube-summarizer

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

youtube-summarizer

目的

此技能从YouTube视频中提取转录文本,并使用STAR + R-I-S-E框架生成全面、详尽的摘要。它会验证视频的可用性,使用 youtube-transcript-api Python库提取转录,并生成详细文档,捕获所有见解、论点和关键点。

该技能专为需要从教育视频、讲座、教程或信息性内容中获取深入内容分析和参考文档的用户设计。

何时使用此技能

当以下情况发生时,应使用此技能:

  • 用户提供YouTube视频URL并希望获得详细摘要
  • 用户需要记录视频内容以供参考,而无需重新观看
  • 用户希望从教育内容中提取见解、关键点和论点
  • 用户需要从YouTube视频中提取转录文本用于分析
  • 用户要求“总结”、“概述”或“提取内容”来自YouTube视频
  • 用户希望获得全面文档,优先考虑完整性而非简洁性

第0步:发现与设置

在处理视频之前,验证环境和依赖项:

# 检查是否已安装 youtube-transcript-api
python3 -c "import youtube_transcript_api" 2>/dev/null
if [ $? -ne 0 ]; then
    echo "⚠️  youtube-transcript-api not found"
    # 提供安装选项
fi

# 检查Python是否可用
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

如果用户选择“是”:

pip install youtube-transcript-api

验证安装:

python3 -c "import youtube_transcript_api; print('✅ youtube-transcript-api installed successfully')"

主要工作流程

进度跟踪指南

在整个工作流程中,在每个步骤之前显示一个可视化的进度条,以使用户了解情况。进度条格式为:

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%               ║
╚══════════════════════════════════════════════════════════════╝

第1步:验证YouTube URL

目标: 提取视频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

操作:

# 使用正则表达式或URL解析提取视频ID
URL="$USER_PROVIDED_URL"

# 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/')
# 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"

如果URL无效:

❌ Invalid YouTube URL

Please provide a valid YouTube URL in one of these formats:
- https://www.youtube.com/watch?v=VIDEO_ID
- https://youtu.be/VIDEO_ID

Example: https://www.youtube.com/watch?v=dQw4w9WgXcQ

第2步:检查视频与转录可用性

进度:

echo "[████████░░░░░░░░░░░░] 40% - Step 2/5: Checking Availability"

目标: 验证视频存在且转录可访问。

操作:

from youtube_transcript_api import YouTubeTranscriptApi, TranscriptsDisabled, NoTranscriptFound
import sys

video_id = sys.argv[1]

try:
    # 获取可用转录列表
    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"要求提供公开视频

第3步:提取转录

进度:

echo "[████████████░░░░░░░░] 60% - Step 3/5: Extracting Transcript"

目标: 以首选语言检索转录。

操作:

from youtube_transcript_api import YouTubeTranscriptApi

video_id = "VIDEO_ID"

try:
    # 首先尝试获取用户首选语言的转录
    # 如果不可用,回退到英语
    transcript = YouTubeTranscriptApi.get_transcript(
        video_id, 
        languages=['pt', 'en']  # 首选葡萄牙语,回退到英语
    )
    
    # 将转录片段合并为全文
    full_text = " ".join([entry['text'] for entry in transcript])
    
    # 获取视频元数据
    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")
    
    # 保存到临时文件用于处理
    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)

转录处理:

  • 将所有转录片段合并为连贯文本
  • 在可用时保留标点符号和格式
  • 移除重复或重叠的片段(如果是自动生成的伪影)
  • 存储到临时文件用于分析

第4步:生成全面摘要

进度:

echo "[████████████████░░░░] 80% - Step 4/5: Generating Summary"

目标: 应用增强的STAR + R-I-S-E提示生成详细摘要。

应用的提示:

使用阶段2中的增强提示(STAR + R-I-S-E框架),并将提取的转录作为输入。

操作:

  1. 加载完整的转录文本
  2. 应用全面的摘要生成提示
  3. 使用AI模型(Claude/GPT)生成结构化摘要
  4. 确保输出遵循定义的结构:
    • 包含视频元数据的标头
    • 执行概要
    • 详细的逐节分解
    • 关键见解和结论
    • 概念和术语
    • 资源和参考

实现:

# 使用转录文件作为AI提示的输入
TRANSCRIPT_FILE="/tmp/transcript_${VIDEO_ID}.txt"

# AI代理将:
# 1. 读取转录
# 2. 应用STAR + R-I-S-E摘要生成框架
# 3. 生成全面的Markdown输出
# 4. 使用标题、列表和高亮进行结构化

Read "$TRANSCRIPT_FILE"  # 将转录读入上下文

然后应用完整的摘要提示(来自阶段2的增强版本)。

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

进度:

echo "[████████████████████] 100% - Step 5/5: Formatting Output"

目标: 以清晰、结构良好的Markdown格式交付摘要。

输出结构:

# [视频标题]

**频道:** [频道名称]  
**时长:** [时长]  
**URL:** [https://youtube.com/watch?v=VIDEO_ID]  
**发布日期:** [如果有日期]


## 📝 详细摘要

### [主题1]

[包含示例、数据、引用等的全面解释...]

#### [子主题1.1]

[详细分解...]

### [主题2]

[继续详细分析...]


## 📚 概念和术语

- **[术语1]:** [定义和上下文]
- **[术语2]:** [定义和上下文]


## 📌 结论

[最终综合和关键要点]

示例2:缺少依赖项

用户输入:

claude> summarize this youtube video https://youtu.be/abc123

技能响应:

⚠️  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

用户选择“是”:

$ pip install youtube-transcript-api
Successfully installed youtube-transcript-api-0.6.1

✅ Installation complete! Proceeding with video summary...

示例4:无效URL

用户输入:

claude> summarize youtube video www.youtube.com/some-video

技能响应:

❌ 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.

📊 执行摘要

欢迎来到这个关于机器学习基础知识的全面教程。在今天的视频中,我们将探索驱动现代AI系统的核心概念...



保存选项:

您想保存什么? → 摘要 + 原始转录

✅ 文件已保存:resumo-exemplo123-2026-02-01.md(包含原始转录) [████████████████████] 100% - ✓ 处理完成!


**版本:** 1.2.0
**最后更新:** 2026-02-02
**维护者:** Eric Andrade

## 局限性
- 仅当任务明确匹配上述范围时才使用此技能。
- 不要将输出视为环境特定验证、测试或专家审查的替代品。
- 如果缺少必需的输入、权限、安全边界或成功标准,请停止并请求澄清。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

AlperTuncOrtak/crypto-data-pipeline

Skill for discovering and researching autonomous AI agents, tools, and ecosystems using the AgentFolio directory.

AlperTuncOrtak/crypto-data-pipeline

Advanced JavaScript animation library skill for creating complex, high-performance web animations.

AlperTuncOrtak/crypto-data-pipeline

One sentence - what this skill does and when to invoke it

AlperTuncOrtak/crypto-data-pipeline

Audit and fix animation performance issues including layout thrashing, compositor properties, scroll-linked motion, and blur effects. Use when animations stutter, transitions jank, or reviewing CSS/JS animation performance.

AlperTuncOrtak/crypto-data-pipeline

Internationalization and localization patterns. Detecting hardcoded strings, managing translations, locale files, RTL support.

AlperTuncOrtak/crypto-data-pipeline

Pull a YouTube video transcript into a queryable markdown vault with yt-dlp subtitle discovery, VTT cleanup, metadata frontmatter, and capture-seed stubs.

AlperTuncOrtak/crypto-data-pipeline

Expert in building portfolios that actually land jobs and clients - not just showing work, but creating memorable experiences. Covers developer portfolios, designer portfolios, creative portfolios, and portfolios that convert visitors into opportunities.

AlperTuncOrtak/crypto-data-pipeline

Generates high-converting Next.js/React landing pages with Tailwind CSS. Uses PAS, AIDA, and BAB frameworks for optimized copy/components (Heroes, Features, Pricing). Focuses on Core Web Vitals/SEO.

AlperTuncOrtak/crypto-data-pipeline

AI-powered animation tool for creating motion in logos, UI, icons, and social media assets.

AlperTuncOrtak/crypto-data-pipeline

CRITICAL: Use for Makepad animation system. Triggers on: makepad animation, makepad animator, makepad hover, makepad state, makepad transition, "from: { all: Forward", makepad pressed, makepad 动画, makepad 状态, makepad 过渡, makepad 悬停效果

AlperTuncOrtak/crypto-data-pipeline

Best practices for Remotion - Video creation in React

AlperTuncOrtak/crypto-data-pipeline

Generate walkthrough videos from Stitch projects using Remotion with smooth transitions, zooming, and text overlays

AlperTuncOrtak/crypto-data-pipeline

Seek and analyze video content using Memories.ai Large Visual Memory Model for persistent video intelligence

AlperTuncOrtak/crypto-data-pipeline

Writes complete, structured landing pages optimized for SEO ranking, AEO citation, and visitor conversion. Activate when the user wants to write or generate a landing page for a product, service, or offer.

AlperTuncOrtak/crypto-data-pipeline

Three.js animation - keyframe animation, skeletal animation, morph targets, animation mixing. Use when animating objects, playing GLTF animations, creating procedural motion, or blending animations.

AlperTuncOrtak/crypto-data-pipeline

Automate TikTok tasks via Rube MCP (Composio): upload/publish videos, post photos, manage content, and view user profiles/stats. Always search tools first for current schemas.

AlperTuncOrtak/crypto-data-pipeline

Video and audio perception, indexing, and editing. Ingest files/URLs/live streams, build visual/spoken indexes, search with timestamps, edit timelines, add overlays/subtitles, generate media, and create real-time alerts.

AlperTuncOrtak/crypto-data-pipeline

Upload, stream, search, edit, transcribe, and generate AI video and audio using the VideoDB SDK.

AlperTuncOrtak/crypto-data-pipeline

One sentence - what this skill does and when to invoke it

AlperTuncOrtak/crypto-data-pipeline

Automate YouTube tasks via Rube MCP (Composio): upload videos, manage playlists, search content, get analytics, and handle comments. Always search tools first for current schemas.

相关技能