youtube-content

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

YouTube Content Tool

YouTube内容工具

When to use

使用场景

Use when the user shares a YouTube URL or video link, asks to summarize a video, requests a transcript, or wants to extract and reformat content from any YouTube video. Transforms transcripts into structured content (chapters, summaries, threads, blog posts).
Extract transcripts from YouTube videos and convert them into useful formats.
当用户分享YouTube URL或视频链接、要求总结视频内容、获取转录文本,或者想要从任意YouTube视频中提取并重新格式化内容时使用。将转录文本转换为结构化内容(章节、摘要、推文线程、博客文章)。
提取YouTube视频的转录文本并将其转换为实用格式。

Setup

安装配置

bash
pip install youtube-transcript-api
bash
pip install youtube-transcript-api

Helper Script

辅助脚本

SKILL_DIR
is the directory containing this SKILL.md file. The script accepts any standard YouTube URL format, short links (youtu.be), shorts, embeds, live links, or a raw 11-character video ID.
bash
undefined
SKILL_DIR
是包含本SKILL.md文件的目录。该脚本支持任何标准YouTube URL格式、短链接(youtu.be)、Shorts短视频、嵌入链接、直播链接,或原始的11位视频ID。
bash
undefined

JSON output with metadata

JSON output with metadata

python3 SKILL_DIR/scripts/fetch_transcript.py "https://youtube.com/watch?v=VIDEO_ID"
python3 SKILL_DIR/scripts/fetch_transcript.py "https://youtube.com/watch?v=VIDEO_ID"

Plain text (good for piping into further processing)

Plain text (good for piping into further processing)

python3 SKILL_DIR/scripts/fetch_transcript.py "URL" --text-only
python3 SKILL_DIR/scripts/fetch_transcript.py "URL" --text-only

With timestamps

With timestamps

python3 SKILL_DIR/scripts/fetch_transcript.py "URL" --timestamps
python3 SKILL_DIR/scripts/fetch_transcript.py "URL" --timestamps

Specific language with fallback chain

Specific language with fallback chain

python3 SKILL_DIR/scripts/fetch_transcript.py "URL" --language tr,en
undefined
python3 SKILL_DIR/scripts/fetch_transcript.py "URL" --language tr,en
undefined

Output Formats

输出格式

After fetching the transcript, format it based on what the user asks for:
  • Chapters: Group by topic shifts, output timestamped chapter list
  • Summary: Concise 5-10 sentence overview of the entire video
  • Chapter summaries: Chapters with a short paragraph summary for each
  • Thread: Twitter/X thread format — numbered posts, each under 280 chars
  • Blog post: Full article with title, sections, and key takeaways
  • Quotes: Notable quotes with timestamps
获取转录文本后,根据用户需求将其格式化:
  • 章节: 按主题变化分组,输出带时间戳的章节列表
  • 摘要: 整个视频的简洁概述,5-10句话
  • 章节摘要: 每个章节附带一段简短摘要
  • 推文线程: Twitter/X推文线程格式——编号帖子,每条不超过280字符
  • 博客文章: 完整文章,包含标题、章节和关键要点
  • 引用内容: 带时间戳的重要引用

Example — Chapters Output

示例——章节输出

00:00 Introduction — host opens with the problem statement
03:45 Background — prior work and why existing solutions fall short
12:20 Core method — walkthrough of the proposed approach
24:10 Results — benchmark comparisons and key takeaways
31:55 Q&A — audience questions on scalability and next steps
00:00 引言——主持人开篇提出问题陈述
03:45 背景介绍——过往研究及现有解决方案的不足
12:20 核心方法——详解提出的方案
24:10 结果展示——基准测试对比及关键要点
31:55 问答环节——观众关于扩展性和下一步计划的问题

Workflow

工作流程

  1. Fetch the transcript using the helper script with
    --text-only --timestamps
    .
  2. Validate: confirm the output is non-empty and in the expected language. If empty, retry without
    --language
    to get any available transcript. If still empty, tell the user the video likely has transcripts disabled.
  3. Chunk if needed: if the transcript exceeds ~50K characters, split into overlapping chunks (~40K with 2K overlap) and summarize each chunk before merging.
  4. Transform into the requested output format. If the user did not specify a format, default to a summary.
  5. Verify: re-read the transformed output to check for coherence, correct timestamps, and completeness before presenting.
  1. 获取:使用带
    --text-only --timestamps
    参数的辅助脚本获取转录文本。
  2. 验证:确认输出内容非空且符合预期语言。若为空,不添加
    --language
    参数重试以获取可用的转录文本。若仍为空,告知用户该视频可能未启用转录功能。
  3. 按需分块:若转录文本超过约50000字符,将其拆分为重叠块(约40000字符,重叠2000字符),先总结每个块再合并结果。
  4. 转换:将转录文本转换为用户请求的格式。若用户未指定格式,默认生成摘要。
  5. 验证:重新检查转换后的输出,确保内容连贯、时间戳正确且完整,再呈现给用户。

Error Handling

错误处理

  • Transcript disabled: tell the user; suggest they check if subtitles are available on the video page.
  • Private/unavailable video: relay the error and ask the user to verify the URL.
  • No matching language: retry without
    --language
    to fetch any available transcript, then note the actual language to the user.
  • Dependency missing: run
    pip install youtube-transcript-api
    and retry.
  • 转录功能未启用:告知用户;建议他们查看视频页面是否有字幕可用。
  • 视频私密/不可用:反馈错误信息,请求用户验证URL。
  • 无匹配语言:不添加
    --language
    参数重试以获取可用的转录文本,然后告知用户实际获取到的语言。
  • 依赖缺失:运行
    pip install youtube-transcript-api
    后重试。