一键导入
vtt-parsing
Use when modifying the WebVTT parser, debugging timestamp truncation, matching Python webvtt library behavior, or working with subtitle files.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when modifying the WebVTT parser, debugging timestamp truncation, matching Python webvtt library behavior, or working with subtitle files.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use when selecting a Gemini model, checking rate limits or quotas, configuring the gemini-rust crate, or debugging model name mismatches.
Create new Kiro skills (Agent Skills). Use when asked to create a skill, write a SKILL.md, add a new workflow to .kiro/skills/, or package agent instructions as a reusable skill.
Use when creating a release, bumping the version, tagging a commit, or working with the GitHub Actions release workflow for rs-summarizer.
Use when editing or creating Askama HTML templates, adding template variables, fixing compile-time template errors, or working with HTMX attributes in templates.
Use when working with tokio::spawn background tasks, the summarization pipeline, task state transitions, or the mark_error/mark_summary_done pattern.
Use when building, running, linting with clippy, formatting with rustfmt, or running cargo commands for the rs-summarizer project.
| name | vtt-parsing |
| description | Use when modifying the WebVTT parser, debugging timestamp truncation, matching Python webvtt library behavior, or working with subtitle files. |
The VTT parser converts WebVTT subtitle files into plain text with second-granularity timestamps. It matches the Python webvtt library behavior byte-for-byte.
s02_parse_vtt_file.py)# Python original:
old_text = ["__bla__"]
old_time = "00:00:00"
out = [dict(text="")]
for c in webvtt.read(filename):
if out[-1]["text"] != old_text[-1]:
out.append(dict(text=old_text[-1], time=old_time))
old_text = c.text.split("\n")
old_time = c.start
# Skip first two entries, format as "HH:MM:SS text\n"
c.text.split("\n")[-1])Auto-generated YouTube captions contain inline VTT tags like <00:00:01.350>, <c>, </c>. These are stripped before processing:
fn strip_vtt_tags(text: &str) -> String {
// Remove anything between < and >
}
vtt crate)Although the vtt crate is in Cargo.toml, a custom parser is used because the vtt crate handles whitespace-only lines differently from Python's webvtt library. The custom parser:
-->)Each line: HH:MM:SS caption_text\n
No milliseconds, no VTT tags, no consecutive duplicate lines.
The test fixture tests/fixtures/cW3tzRzTHKI.en.vtt produces a known 37-line output that matches the Python implementation byte-for-byte.
src/utils/vtt_parser.rs — Parser implementationtests/fixtures/cW3tzRzTHKI.en.vtt — Test fixturesource04/tsum/s02_parse_vtt_file.py — Python originalsource04/tsum/t02_parse_vtt_file.py — Python ground truth test