bilibili-render-pdf
Generate a professional, detailed, figure-rich LaTeX course note and final PDF from a Bilibili lecture, tutorial, or technical talk. Use when the user provides a Bilibili URL (BV number) and wants structured Chinese teaching notes that combine the video's title, chapters, diagrams, formulas, code, s
By wdkns · 353 installs
npx skills add wdkns/wdkns-skills --skill bilibili-render-pdf
Source repository · Upstream listing
Bilibili Render PDF
Use this skill to turn a Bilibili video into a complete, compileable .tex note and a rendered PDF.
This skill extends the youtube render pdf workflow with Bilibili specific adaptations for subtitle scarcity, login gated high resolution, multi part (分P) videos, and platform specific non teaching content.
Bilibili vs YouTube: Key Differences
Aspect Handling
Subtitle scarcity Try CC subtitles first → fall back to Whisper speech to text → visual only mode
Login gated HD 1080P+ requires cookies; prompt the user to use yt dlp cookies from browser chrome
Multi part videos Detect 分P videos and ask the user which parts to process
URL formats Support bilibili.com/video/BVxxxxxxx and b23.tv short links
Danmaku Do not use danmaku as a teaching content source (too noisy); use only CC subtitles or Whisper output
Goal
Produce a professional Chinese lecture note from a Bilibili URL.
The output must:
use the video's actual teaching content rather than subtitle transcription alone
place the video's original cover image on the front page of the .tex and rendered PDF whenever available
include all necessary high value key frames as figures, without adding redundant screenshots
end with a final synthesis section that includes the speaker's substantive closing discussion and your own distilled takeaways
be structurally organized with \section{...} and \subsection{...}
be a complete .tex document from \documentclass to \end{document}
be compiled successfully to PDF as part of the final delivery
Pedagogical Standard
The notes must read like a strong human teacher is guiding the reader through the material.
organize each major section so the reader first understands the motivation, then the main idea, then the mechanism, then the example or evidence, and finally the takeaway
be patient and explicit about logical transitions; make it clear why the speaker introduces a concept, what problem it solves, and how the next idea follows
aim for deep but accessible explanations: keep the technical depth, but introduce formalism only after giving intuition in plain language
when a section is dense, break it into smaller subsections that progressively build understanding rather than compressing everything into one long derivation
do not dump subtitle content in chronological order; rewrite it into a teaching sequence with clear intent, contrast, and buildup
Source Acquisition
Metadata Inspection
1. Inspect the video metadata first.
Prefer title, chapters, duration, thumbnail availability, and subtitle availability before writing.
2. Detect multi part (分P) videos.
List all parts and ask the user which parts to process before downloading.
Subtitle Acquisition (Three Level Fallback)
Priority 1: CC subtitles (platform embedded)
Use manual subtitles over auto generated subtitles when both are available.
Prefer zh Hans , zh CN , zh , or ai zh subtitle tracks.
Preserve the subtitle timestamps; do not flatten subtitles into plain text too early if figures still need to be located.
Priority 2: Whisper speech to text (when no CC subtitles are available)
Extract audio first, then transcribe with Whisper to produce a timestamped SRT file.
Priority 3: Visual only mode (when audio quality is too poor)
Skip subtitles entirely and rely on dense frame sampling to extract teaching content from the video frames alone.
Video and Cover Download
1. Acquire the video's original cover image before writing the .tex .
Prefer the highest resolution thumbnail exposed by the platform metadata.
Save the selected cover locally and reference that local asset from the front page.
2. Prefer the best usable video source for figure extraction.
Probe formats and choose the highest resolution that is actually downloadable in the current environment.
Note that 1080P+ on Bilibili typically requires login cookies.
3. Keep all source artifacts local when practical.
Typical working artifacts are metadata, the downloaded cover image, a timestamped subtitle file (CC or Whisper generated), optional cleaned transcript text, a local video file, and extracted frames.
Long Video Strategy
For longer videos, do not rely on a single monolithic pass.
If the video is longer than 20 minutes, or the subtitle file contains more than 300 subtitle entries, split the work into smaller segments.
Prefer chapter boundaries or 分P boundaries for splitting. If those are unavailable or too uneven, split by coherent time windows or subtitle ranges.
When subagents are available, spawn multiple subagents in parallel for different segments so coverage stays high and detail is not lost.
Give each subagent a concrete segment boundary and require it to return: the segment's teaching goal, the core claims, important formulas or code, required figures with time provenance, and any ambiguities that need integration time resolution.
Keep a small overlap between neighboring segments when the explanation crosses boundaries, then deduplicate during integration.
The main agent must integrate the segment outputs into one unified outline and one coherent final narrative. The final PDF must read like a single lecture note, not a concatenation of chunk summaries.
Teaching Content Rules
Build the notes from all of the following when available:
video title and chapter structure
the video's original cover image and key metadata
on screen diagrams, formulas, tables, plots, and architecture slides
subtitle explanations, examples, and verbal emphasis
short high signal original dialogue segments in interview, panel, podcast, or conversation videos, when the exact wording adds presence, humor, intuition, or unusually compact information
code snippets shown or described in the talk
Skip content that does not contribute to the actual lesson:
greetings
small talk
routine back and forth that does not add information, tension, humor, intuition, or teaching value
sponsorship
channel logistics (一键三连, 关注投币, etc.)
closing pleasantries
Keep the speaker's closing discussion when it carries actual teaching value, such as synthesis, limitations, future work, tradeoffs, advice, or open questions.
Writing Rules
1. Write the notes in Chinese unless the user explicitly requests another language.
2. Organize the document with \section{...} and \subsection{...} .
Reconstruct the teaching flow when needed; do not blindly mirror subtitle order.
Each section should answer, in order when applicable: what problem is being solved, why simpler views are insufficient, what the core idea is, how it works, and what the reader should retain.
Avoid overusing the "不是……而是……" sentence pattern.
Use it only when the video itself establishes a real contrast and that contrast materially clarifies the mechanism.
Do not use vague or overly abstract phrasing.
Ground claims in concrete mechanisms, examples, variables, steps, observed phenomena, timestamps, figures, or speaker provided evidence whenever possible.
3. Start from assets/notes template.tex .
Fill in the metadata block, including the local cover image path, and replace the body content block with the generated notes.
4. The front page must include the video's original cover image when available.
Place it on the first page rather than burying it later in the document.
Keep it visually distinct from in body teaching figures.
5. Use figures whenever they materially improve explanation.
Include as many figures as are necessary for teaching clarity, even if that means many figures across the document.
Do not optimize for a small figure count; optimize for explanatory coverage and readability.
Good figures are key formulas, diagrams, tables, plots, visual comparisons, pipeline schedules, architecture views, and stage by stage visual progressions.
6. Do not place images inside custom message boxes.
7. When a mathematical formula appears:
first explain in plain Chinese what the formula is trying to express and why it appears
show it in display math using $$...$$
then immediately follow with a flat list that explains every symbol
8. When code examples appear:
explain the role of the code before the listing and summarize the expected behavior after it when useful
wrap them in lstlisting
include a descriptive caption
9. Highlight teaching signals deliberately and repeatedly when the content justifies it:
use importantbox for core concepts the reader must walk away with, including formal definitions, central claims, key mechanism summaries, theorem like statements, critical algorithm steps, and compact restatements of the main idea after a dense explanation
use knowledgebox for background and side knowledge that improves understanding without being the main thread, including prerequisite reminders, historical lineage, engineering context, design tradeoffs, terminology comparisons, and intuition building analogies
use warningbox for common misunderstandings and failure points, including notation overload, hidden assumptions, misleading heuristics, easy to make implementation mistakes, causal confusions, off by one style reasoning errors, and places where the speaker contrasts a wrong intuition with the correct one
use dialoguebox only for conversation heavy videos when a brief original dialogue segment is high information, funny, vivid, or especially intuitive, and preserving the speaker's wording gives the reader a stronger sense of being present in the discussion
a dialoguebox may contain either one exchange or several tightly connected turns, such as a question, follow up, pushback, clarification, and answer sequence
keep dialoguebox snippets short: preserve speaker labels and a concrete timestamp or interval, lightly clean obvious ASR errors only when confident, and follow the box with prose that explains why the dialogue segment matters
do not use dialoguebox for greetings, filler, long transcript dumps, or dialogue that would be clearer as ordinary summarized exposition
there is no quota of one box per section; add multiple boxes in a section when the material contains multiple distinct teaching signals
each box should carry a specific pedagogical payload rather than generic emphasis
prefer placing a box immediately after the paragraph, derivation, or example that motivates it
routine exposition should stay in normal prose; boxes are for high signal takeaways, not decoration
figures must stay outside importantbox , knowledgebox , warningbox , and dialoguebox
10. End every major section with \subsection{本章小结} .
Add \subsection{拓展阅读} when there are one or two worthwhile external links.
11. End the document with a final top level section such as \section{总结与延伸} .
That final section must include:
the speaker's substantive closing discussion, excluding routine sign off language
your own structured distillation of the core claims, mechanisms, and practical implications
your expanded synthesis, including conceptual compression, cross links between sections, and any careful generalization that stays faithful to the video
concrete takeaways, open questions, or next steps when the material supports them
12. Do not emit [cite] style placeholders anywhere in the LaTeX.
Figure Handling
Select figures by necessity and teaching value, not by an arbitrary quota or a bias toward keeping the document visually sparse.
When locating candidate frames, bias strongly toward recall before precision.
It is better to inspect too many nearby candidates first than to miss the one frame where the slide, formula, table, or diagram is finally fully revealed and readable.
Frame understanding must come from direct visual inspection.
Use the view image tool to inspect candidate frames and crops be