YouTube Summary (youtube2md)
Use the official youtube2md CLI behavior from the repository.
Runtime + security prerequisites
- - Require Node.js 18+.
- Require preinstalled
youtube2md on PATH.
- Recommended pinned install:
npm i -g youtube2md@1.0.1
- - Require python3 for transcript text preparation (
prepare.py) in extract mode. - Default runner uses local
youtube2md executable only. - Runtime npm execution (
npx) is intentionally not supported in this skill. - The
YOUTUBE2MD_BIN environment variable override is rejected by the runner. - INLINECODE7 enables full summarization mode; transcript/content may be sent to OpenAI through youtube2md’s workflow.
- For sensitive content, omit
OPENAI_API_KEY and use extract mode.
- - In sensitive environments, audit the upstream
youtube2md package and dependencies before installation or version bumps.
See references/security.md before first-time install/enable.
Workflow
- 1. Validate input
- Accept
youtube.com and
youtu.be URLs.
- If URLs are missing, ask for one URL per line.
- 2. Choose mode
-
Full mode: generates Markdown.
- Use when
OPENAI_API_KEY is available and external API use is acceptable.
-
Extract mode (
--extract-only): outputs transcript JSON and prepares transcript text (
.txt).
- Use when API key is unavailable or when transcript-only output is requested.
- Prefer a
no-error path: check key first and run extract directly when key is missing.
- 3. Run converter
- Preferred runner script:
-
scripts/run_youtube2md.sh <url> full [output_md_path] [language] [model]
- If
OPENAI_API_KEY is missing, runner auto-falls back to extract mode by default.
-
scripts/run_youtube2md.sh <url> extract [output_json_path]
- Optional machine-readable CLI output:
-
YOUTUBE2MD_JSON=1 scripts/run_youtube2md.sh <url> full
-
YOUTUBE2MD_JSON=1 scripts/run_youtube2md.sh <url> extract
- Runtime controls:
- Use only locally installed
youtube2md executable.
- Do not use runtime npm execution (
npx) for this skill.
- Direct CLI equivalent:
-
youtube2md --url <url> [--out <path>] [--lang <language>] [--model <model>]
- Add
--extract-only for transcript-only mode.
- 4. Verify output
- Full mode: Markdown file exists and is non-empty.
- Extract mode: JSON file exists and is non-empty.
- Extract mode: prepared TXT file exists and is non-empty.
- If using
--json, parse
ok: true/false and handle error
code.
- 5. Respond to the user
- Follow
references/output-format.md as the default response shape.
- Follow
references/summarization-behavior.md for source policy and chapter/takeaway density.
- Do
not include generated local file path(s) in normal user-facing replies.
- Share file paths only when explicitly requested by the user (e.g., debugging/export workflows).
-
Summary source policy:
- Full mode succeeded → use youtube2md Markdown output as the summary source.
- Non-full mode (extract) → use prepared
.txt transcript text as the summary source.
- Keep user-facing flow smooth: if key is missing, use extract output and summarize from
.txt without surfacing avoidable tool-error noise.
Multi-video requests
- - Process URLs sequentially.
- Return per-video summary results (omit local file paths unless requested).
- If any fail, report successful items first, then failures with fixes.
Built-in behavior to trust
- Full mode:
./summaries/<video_id>.md
- Extract mode:
./summaries/<video_id>.json
- Local runner post-process (extract):
./summaries/<video_id>.txt via INLINECODE35
Packaging hygiene
- - Do not publish generated outputs (e.g.,
summaries/*.json, summaries/*.txt) inside the skill folder. - Keep only source files (
SKILL.md, scripts/, references/, helpers) in release artifacts.
Resources
- - CLI runner: INLINECODE41
- Transcript text prep: INLINECODE42
- Output guidance: INLINECODE43
- Behavior reference: INLINECODE44
- Security/install notes: INLINECODE45
- Troubleshooting and error codes: INLINECODE46
YouTube 摘要 (youtube2md)
使用仓库中的官方 youtube2md CLI 行为。
运行时 + 安全前提条件
- - 需要 Node.js 18+。
- 需要在 PATH 中预装 youtube2md。
- 推荐固定版本安装:npm i -g youtube2md@1.0.1
- - 在提取模式下,需要 python3 用于转录文本准备(prepare.py)。
- 默认运行器仅使用本地 youtube2md 可执行文件。
- 此技能有意不支持运行时 npm 执行(npx)。
- 运行器拒绝 YOUTUBE2MDBIN 环境变量覆盖。
- OPENAIAPI_KEY 启用完整摘要模式;转录/内容可能通过 youtube2md 的工作流程发送至 OpenAI。
- 对于敏感内容,省略 OPENAI
APIKEY 并使用提取模式。
- - 在敏感环境中,在安装或版本升级前审计上游 youtube2md 包及其依赖项。
首次安装/启用前请参阅 references/security.md。
工作流程
- 1. 验证输入
- 接受 youtube.com 和 youtu.be 网址。
- 如果缺少网址,每行询问一个网址。
- 2. 选择模式
-
完整模式:生成 Markdown。
- 当 OPENAI
APIKEY 可用且可接受外部 API 使用时使用。
-
提取模式(--extract-only):输出转录 JSON 并准备转录文本(.txt)。
- 当 API 密钥不可用或仅请求转录输出时使用。
- 优先选择
无错误路径:先检查密钥,密钥缺失时直接运行提取。
- 3. 运行转换器
- 首选运行器脚本:
- scripts/run
youtube2md.sh full [outputmd_path] [language] [model]
- 如果 OPENAI
APIKEY 缺失,运行器默认自动回退到提取模式。
- scripts/run
youtube2md.sh extract [outputjson_path]
- 可选的机器可读 CLI 输出:
- YOUTUBE2MD
JSON=1 scripts/runyoutube2md.sh
full
- YOUTUBE2MDJSON=1 scripts/runyoutube2md.sh extract
- 运行时控制:
- 仅使用本地安装的 youtube2md 可执行文件。
- 此技能不要使用运行时 npm 执行(npx)。
- 直接 CLI 等效命令:
- youtube2md --url [--out ] [--lang ] [--model ]
- 添加 --extract-only 用于仅转录模式。
- 4. 验证输出
- 完整模式:Markdown 文件存在且非空。
- 提取模式:JSON 文件存在且非空。
- 提取模式:准备的 TXT 文件存在且非空。
- 如果使用 --json,解析 ok: true/false 并处理错误 code。
- 5. 响应用户
- 遵循 references/output-format.md 作为默认响应格式。
- 遵循 references/summarization-behavior.md 关于来源策略和章节/要点密度。
- 不要在常规面向用户的回复中包含生成的本地文件路径。
- 仅在用户明确请求时(例如调试/导出工作流程)分享文件路径。
- 摘要来源策略:
- 完整模式成功 → 使用 youtube2md Markdown 输出作为摘要来源。
- 非完整模式(提取)→ 使用准备的 .txt 转录文本作为摘要来源。
- 保持面向用户的流程顺畅:如果密钥缺失,使用提取输出并从 .txt 生成摘要,不暴露可避免的工具错误噪音。
多视频请求
- - 按顺序处理网址。
- 返回每个视频的摘要结果(除非请求,否则省略本地文件路径)。
- 如果有任何失败,先报告成功的项目,然后报告失败及修复方法。
可信任的内置行为
- 完整模式:./summaries/.md
- 提取模式:./summaries/.json
- 本地运行器后处理(提取):通过 prepare.py 生成 ./summaries/.txt
打包规范
- - 不要将生成的输出(例如 summaries/.json、summaries/.txt)发布到技能文件夹内。
- 在发布产物中仅保留源文件(SKILL.md、scripts/、references/、辅助工具)。
资源
- - CLI 运行器:scripts/run_youtube2md.sh
- 转录文本准备:prepare.py
- 输出指南:references/output-format.md
- 行为参考:references/summarization-behavior.md
- 安全/安装说明:references/security.md
- 故障排除和错误代码:references/troubleshooting.md