Communitygithub.com

youtube-summarizer

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

youtube-summarizer 是什么?

这个技能(youtube-summarizer)利用 `youtube-transcript-api` Python 库从 YouTube 视频中提取转录文本,然后通过结合 STAR 和 R-I-S-E 框架的增强提示词生成非常详细的结构化摘要。它专门用于需要深入分析教育视频、讲座、教程或信息性内容的用户。该技能会首先验证环境的依赖关系,确保所有必需的工具都已安装。工作流程包括验证 URL 格式、检查视频和转录文本的可用性、提取首选语言的转录文本、应用高级提示词生成摘要,最后以格式良好的 Markdown 文稿形式输出结果,包括视频元数据、执行摘要、逐节细分、关键概念和术语。错误处理十分完善,能够优雅地处理无效 URL、缺失的转录文本和缺少的依赖关系等情况。它支持主流的 YouTube 网址格式,并能在提取过程中自动保存原始转录文本。用户可以通过进度指示器清晰了解处理步骤。

兼容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/AbobakrDiara61/railway-system/tree/HEAD/frontend/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"
    # 提供安装选项
fi

# 检查 Python 是否可用
if ! command -v python3 &>/dev/null; then
    echo "❌ 需要 Python 3,但未安装"
    exit 1
fi

如果缺少依赖,请询问用户:

youtube-transcript-api 是必需的,但尚未安装。

是否希望现在安装?
- [ ] 是 - 使用 pip 安装 (pip install youtube-transcript-api)
- [ ] 否 - 我将手动安装

如果用户选择“是”:

pip install youtube-transcript-api

验证安装:

python3 -c "import youtube_transcript_api; print('✅ youtube-transcript-api 安装成功')"

主要工作流程

进度跟踪指南

在整个工作流程中,在每个步骤之前显示一个可视化进度条,以便让用户了解最新状态。进度条格式如下:

echo "[████░░░░░░░░░░░░░░░░] 20% - 步骤 1/5:验证 URL"

格式规范:

  • 宽度为 20 个字符(使用 █ 表示已完成,░ 表示未完成)
  • 百分比增量:步骤 1 = 20%,步骤 2 = 40%,步骤 3 = 60%,步骤 4 = 80%,步骤 5 = 100%
  • 显示当前/总步骤数的计数器(例如“步骤 3/5”)
  • 当前阶段的简要描述

在步骤 1 之前显示初始状态框:

╔══════════════════════════════════════════════════════════════╗
║     📹  YouTube 摘要生成器 - 处理视频                        ║
╠══════════════════════════════════════════════════════════════╣
║ → 步骤 1:验证 URL                    [进行中]               ║
║ ○ 步骤 2:检查可用性                                        ║
║ ○ 步骤 3:提取转录文本                                      ║
║ ○ 步骤 4:生成摘要                                          ║
║ ○ 步骤 5:格式化输出                                        ║
╠══════════════════════════════════════════════════════════════╣
║ 进度:██████░░░░░░░░░░░░░░░░░░░░░░░░  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"

# 模式 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/')
# 模式 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 "❌ 无效的 YouTube URL 格式"
    exit 1
fi

echo "📹 视频 ID 已提取:$VIDEO_ID"

如果 URL 无效:

❌ 无效的 YouTube URL

请提供以下格式之一的有效 YouTube URL:
- https://www.youtube.com/watch?v=VIDEO_ID
- https://youtu.be/VIDEO_ID

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

步骤 2:检查视频和转录文本可用性

进度:

echo "[████████░░░░░░░░░░░░] 40% - 步骤 2/5:检查可用性"

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

操作:

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_id}")
    print("📝 可用转录文本:")
    
    for transcript in transcript_list:
        print(f"  - {transcript.language} ({transcript.language_code})")
        if transcript.is_generated:
            print("    [自动生成]")
    
except TranscriptsDisabled:
    print(f"❌ 视频 {video_id} 的转录文本已被禁用")
    sys.exit(1)
    
except NoTranscriptFound:
    print(f"❌ 未找到视频 {video_id} 的转录文本")
    sys.exit(1)
    
except Exception as e:
    print(f"❌ 访问视频时出错:{e}")
    sys.exit(1)

错误处理:

错误消息操作
视频未找到"❌ 视频不存在或为私有"要求用户验证 URL
转录文本被禁用"❌ 此视频的转录文本已被禁用"无法继续
无可用转录文本"❌ 未找到转录文本(未自动生成或手动添加)"无法继续
私有/受限视频"❌ 视频为私有或受限"要求提供公开视频

步骤 3:提取转录文本

进度:

echo "[████████████░░░░░░░░] 60% - 步骤 3/5:提取转录文本"

目标: 检索首选语言的转录文本。

操作:

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("✅ 转录文本提取成功")
    print(f"📊 转录文本长度:{len(full_text)} 个字符")
    
    # 保存到临时文件以供处理
    with open(f"/tmp/transcript_{video_id}.txt", "w") as f:
        f.write(full_text)
    
except Exception as e:
    print(f"❌ 提取转录文本时出错:{e}")
    exit(1)

转录文本处理:

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

步骤 4:生成全面摘要

进度:

echo "[████████████████░░░░] 80% - 步骤 4/5:生成摘要"

目标: 应用增强的 STAR + R-I-S-E 提示词来创建详细摘要。

应用的提示词:

使用第二阶段(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"  # 将转录文本读入上下文

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

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

进度:

echo "[████████████████████] 100% - 步骤 5/5:格式化输出"

目标: 以清晰、结构良好的 Markdown 提供摘要。

输出结构:

# [视频标题]

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


## 📝 详细摘要

### [主题 1]

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

#### [子主题 1.1]

[详细分解...]

### [主题 2]

[继续详细分析...]


## 📚 概念和术语

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


## 📌 结论

[最终总结和要点]

示例 2:缺少依赖

用户输入:

claude> 总结这个 YouTube 视频 https://youtu.be/abc123

技能响应:

⚠️  未安装 youtube-transcript-api

此技能需要使用 Python 库 'youtube-transcript-api'。

是否希望我现在安装它?
- [ ] 是 - 使用 pip 安装
- [ ] 否 - 我将手动安装

用户选择“是”:

$ pip install youtube-transcript-api
已成功安装 youtube-transcript-api-0.6.1

✅ 安装完成!继续视频摘要...

示例 4:无效 URL

用户输入:

claude> 总结 YouTube 视频 www.youtube.com/some-video

技能响应:

❌ 无效的 YouTube URL 格式

预期的格式示例:
- https://www.youtube.com/watch?v=VIDEO_ID
- https://youtu.be/VIDEO_ID

请提供有效的 YouTube 视频 URL。

📊 执行摘要

该视频全面介绍了人工智能(AI)的基本概念,专为希望了解现代 AI 技术基础和实际应用的初学者和专业人士设计。讲师涵盖了从基本定义到机器学习算法的所有内容,并使用实际示例和可视化来帮助理解。

[... 继续详细的摘要 ...]


**保存选项:**

您希望保存什么? → 摘要 + 原始转录文本

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



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

版本: 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.

AbobakrDiara61/railway-system

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

AbobakrDiara61/railway-system

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

AbobakrDiara61/railway-system

Astropy is the core Python package for astronomy, providing essential functionality for astronomical research and data analysis.

AbobakrDiara61/railway-system

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

AbobakrDiara61/railway-system

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.

AbobakrDiara61/railway-system

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

AbobakrDiara61/railway-system

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.

AbobakrDiara61/railway-system

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.

AbobakrDiara61/railway-system

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

AbobakrDiara61/railway-system

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 悬停效果

AbobakrDiara61/railway-system

Best practices for Remotion - Video creation in React

AbobakrDiara61/railway-system

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

AbobakrDiara61/railway-system

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

AbobakrDiara61/railway-system

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.

AbobakrDiara61/railway-system

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

AbobakrDiara61/railway-system

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.

AbobakrDiara61/railway-system

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.

AbobakrDiara61/railway-system

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

AbobakrDiara61/railway-system

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

AbobakrDiara61/railway-system

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.

相关技能