Communitygithub.com

JoeyRedfield/videobook

用 videobook 流水线把一个 YouTube / Bilibili 视频(尤其是课程录像)做成图文并茂的 Markdown + HTML 技术电子书:提取字幕(平台无字幕时用本地 faster-whisper ASR 兜底)、由大模型改写并插入 SCREENSHOT/SLIDE 占位、用已登录浏览器直接截取播放器高画质帧、渲染暗色主题 HTML 并起本地预览、可选抓取课程官方讲义与 4K 幻灯片增强、生成字幕校订对照稿、最后发布到 GitHub Pages 的 pages 分支。当用户给出视频链接或 BV 号并要求做成电子书/教程/图文/文档、要字幕纠错对照稿、要给文章配视频截图、或要发布已生成的 output 时使用。不负责单纯下载视频或字幕、视频剪辑,以及与本流水线无关的网页爬取。

videobook 是什么?

videobook is a Claude Code agent skill that 用 videobook 流水线把一个 YouTube / Bilibili 视频(尤其是课程录像)做成图文并茂的 Markdown + HTML 技术电子书:提取字幕(平台无字幕时用本地 faster-whisper ASR 兜底)、由大模型改写并插入 SCREENSHOT/SLIDE 占位、用已登录浏览器直接截取播放器高画质帧、渲染暗色主题 HTML 并起本地预览、可选抓取课程官方讲义与 4K 幻灯片增强、生成字幕校订对照稿、最后发布到 GitHub Pages 的 pages 分支。当用户给出视频链接或 BV 号并要求做成电子书/教程/图文/文档、要字幕纠错对照稿、要给文章配视频截图、或要发布已生成的 output 时使用。不负责单纯下载视频或字幕、视频剪辑,以及与本流水线无关的网页爬取。.

兼容平台✓Claude Code✓Codex CLI~Cursor
npx skills add https://github.com/JoeyRedfield/videobook/tree/HEAD/skills/videobook

在你喜欢的 AI 中提问

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

文档

VideoBook: Turn a Video into an Illustrated eBook

Given a YouTube / Bilibili link by the user, produce a readable technical eBook: output/<video_id>/book.md + book.html (with embedded player card, click-to-enlarge screenshots, Mermaid diagrams), and optionally transcript.corrected.txt (corrected transcript) and publish to GitHub Pages for others to read.

This skill is the orchestration layer and is self-contained: all instructions needed by the agent are in this directory (SKILL.md + references/), and do not rely on the repo's instructions.md / README.md (those are for human readers, kept untouched and not maintained by this skill). The only external dependency is the pipeline's executable code src/*.py: commands and parameters must follow the script's --help output; do not rewrite script logic. Volatile data (e.g., the mispronunciation MAP in src/make_corrected.py) must not be copied into the skill; only state the rule and point to the source file. The one exception is the formatting instruction for step 2: this directory carries an in-tree copy at references/stitcher-prompt.md (the repo version takes precedence).

Prerequisites (must read before first run)

  1. Working directory = videobook repo root (check: existence of src/dump_transcript.py and prompts/), all relative paths (output/<video_id>/...) are resolved relative to it. If the repo is not local, first git clone https://github.com/Luke-Evan/videobook.git into the user's code projects directory (do not use a temporary directory or create a separate projects folder), then cd into it.
  2. Python >= 3.10 (recommended 3.12). Install dependencies: uv sync (when using uv) or pip install -r requirements.txt. Execute commands using the repo's environment interpreter: uv run python src/xxx.py or .venv/Scripts/python.exe src/xxx.py.
  3. One-time login: python src/capture_frames.py --setup-profile opens a dedicated Chrome (data directory .capture-profile/), log in to Bilibili / YouTube via QR code, then close the window; the login state is reused long-term. The membership tier of the logged-in account determines the maximum screenshot resolution.
  4. For overseas videos: terminal must use proxy (for subtitle fetching), browser also needs global proxy (otherwise the YouTube iframe in the generated page shows a black block).
  5. Commands requiring elevated privileges (outside sandbox) are noted in the last column of the overview table; purely local steps can run inside the sandbox.

Pipeline Overview

StepWhat it doesCommandDetailsElevated Privileges
1Fetch subtitlespython src/dump_transcript.py "<URL>"references/transcript.mdBilibili needs
1bLocal ASR fallback when platform has no subtitlespython src/asr_transcript.py <video_id>references/transcript.mdNo (time-consuming)
1.5Official course notes + 4K slides (run by default, skip only if the course has no homepage)python src/course_assets.py <video_id> --course-url <course homepage>references/course-assets.mdNeeds for rendering
2LLM rewrites subtitles into book.mdFollow formatting instructions (references/stitcher-prompt.md; use the repo prompts/stitcher_system.md if it exists)references/writing.mdNo
2bCorrected transcript (optional)python src/make_corrected.py <video_id>references/correction.mdNo
3Capture frames and materialize placeholders into imagespython src/capture_frames.py <video_id> "<URL>"references/capture.mdYes
4Render HTML + start local previewpython src/post_process.py "<URL>" output/<id>/book.md then python -m http.server 8080 --directory output/<id>—No
5Inform user of results, ask about large file cleanup—See "Delivery" below—
6Publish output to pages branch (optional)python src/publish.py <video_id> then git push origin pagesreferences/publish.mdNo (push needs network)

For errors, quality issues, subtitle fetch failures, ASR interruptions, first check references/troubleshooting.md.

Hard Rules (non-negotiable)

  1. If subtitle coverage < 50% (exit code 3), do not proceed to step 2: first fix login state/proxy, or switch to ASR fallback.
  2. All screenshot frames must come from the platform player in a logged-in browser; step 3 must never download video/audio files (ffmpeg frame extraction is only the last resort). See references/capture.md for a list of prohibited methods.
  3. Cookies are written only to the system temp directory and deleted after use; never commit them to the repo or manually place cookies.txt in the workspace.
  4. output/ is unaffected by any git operations; deliverables are published only to the orphan pages branch; main contains only code.
  5. Fidelity of correction draft: preserve the original wording and order of the lecturer paragraph by paragraph; only perform ASR mispronunciation replacement + filler word cleanup; no paragraph deletion, no line merging, no heavy rewriting (the validation layer will reject it).
  6. Fidelity baseline for writing: Written form ≠ summary; retain analogies, examples, derivation chains; editor additions must be marked with "Editor's note".
  7. Copyright of course materials: notes and slides belong to the lecturer (commonly CC BY-NC); the book's opening info block and closing section must retain source links, author attribution, and license name.
  8. Slide coverage rule: each page in slides_text.md must appear exactly once in the book; --audit must PASS before submission.
  9. Delete large files (audio.m4a, video_source.mp4, etc.) only after asking the user and receiving confirmation.
  10. When generating or modifying HTML, ensure text-to-background contrast ratio is no lower than WCAG AA's 4.5:1.
  11. Each step is idempotent and re-runnable: before materializing placeholders, the script automatically backs up book.tagged.md; as long as it exists, re-running step 3 can restore screenshots.

Delivery (step 5 must convey all at once)

  1. Location of output/<video_id>/book.md;
  2. Preview URL http://localhost:8080/book.html; stop the server by pressing Ctrl+C in the terminal;
  3. YouTube videos require the browser to access YouTube (proxy); Bilibili videos can be watched directly;
  4. Screenshot quality depends on the membership tier of the account logged in .capture-profile/; to get higher quality, log in with a different account and re-run step 3;
  5. When official course materials are used, note that the slides in the book are official 4K renders (the book header already notes the source and CC license), demo frames are still video frames; the course/ directory can be deleted entirely without affecting reading;
  6. Ask whether to delete large media files generated during the pipeline (Hard Rule 9).

Directory Contents (read on demand, not all at once)

FileWhen to read
references/transcript.mdStep 1 fetching subtitles; if platform has no subtitles, switch to local ASR
references/writing.mdStep 2 rewriting subtitles into book.md
references/stitcher-prompt.mdStep 2 original formatting instructions (use repo prompts/stitcher_system.md if it exists)
references/course-assets.mdStep 1.5 when course has an official homepage, slide coverage rules, slide upgrades
references/correction.mdGenerating corrected transcript and AI line-level correction proposals
references/capture.mdStep 3 frame capture: priority order, explicitly prohibited methods, QA habits
references/publish.mdStep 6 publishing to pages branch
references/troubleshooting.mdAny errors, quality anomalies, subtitle fetch failures, elevated privilege denial

Maintenance Conventions

  • This skill is versioned together with the pipeline code in the same repo: if parameters, step order, or hard rules in src/*.py change, this directory must be updated accordingly.
  • The repo's instructions.md and README.md are for human readers and are kept untouched; this skill does not maintain them. Do not modify them to make the skill work; when content overlaps with this directory, the agent defers to this directory.
  • When syncing references/stitcher-prompt.md, update the commit hash in the source note at the file header.
  • For others to install: use skill-installer with --repo Luke-Evan/videobook --path skills/videobook; or after cloning, copy/symlink this directory to ~/.codex/skills/ (Codex only) or ~/.agents/skills/ (cross-agent).
  • This directory contains no cookies, login state, output/ artifacts, or any media files, and can be safely distributed publicly.

相关技能