youtube-content
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseYouTube 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-apibash
pip install youtube-transcript-apiHelper Script
辅助脚本
SKILL_DIRbash
undefinedSKILL_DIRbash
undefinedJSON 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
undefinedpython3 SKILL_DIR/scripts/fetch_transcript.py "URL" --language tr,en
undefinedOutput 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 steps00:00 引言——主持人开篇提出问题陈述
03:45 背景介绍——过往研究及现有解决方案的不足
12:20 核心方法——详解提出的方案
24:10 结果展示——基准测试对比及关键要点
31:55 问答环节——观众关于扩展性和下一步计划的问题Workflow
工作流程
- Fetch the transcript using the helper script with .
--text-only --timestamps - Validate: confirm the output is non-empty and in the expected language. If empty, retry without to get any available transcript. If still empty, tell the user the video likely has transcripts disabled.
--language - Chunk if needed: if the transcript exceeds ~50K characters, split into overlapping chunks (~40K with 2K overlap) and summarize each chunk before merging.
- Transform into the requested output format. If the user did not specify a format, default to a summary.
- Verify: re-read the transformed output to check for coherence, correct timestamps, and completeness before presenting.
- 获取:使用带参数的辅助脚本获取转录文本。
--text-only --timestamps - 验证:确认输出内容非空且符合预期语言。若为空,不添加参数重试以获取可用的转录文本。若仍为空,告知用户该视频可能未启用转录功能。
--language - 按需分块:若转录文本超过约50000字符,将其拆分为重叠块(约40000字符,重叠2000字符),先总结每个块再合并结果。
- 转换:将转录文本转换为用户请求的格式。若用户未指定格式,默认生成摘要。
- 验证:重新检查转换后的输出,确保内容连贯、时间戳正确且完整,再呈现给用户。
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 to fetch any available transcript, then note the actual language to the user.
--language - Dependency missing: run and retry.
pip install youtube-transcript-api
- 转录功能未启用:告知用户;建议他们查看视频页面是否有字幕可用。
- 视频私密/不可用:反馈错误信息,请求用户验证URL。
- 无匹配语言:不添加参数重试以获取可用的转录文本,然后告知用户实际获取到的语言。
--language - 依赖缺失:运行后重试。
pip install youtube-transcript-api