Skip to content

feat: add WebVTT converter#14

Open
bjesuiter wants to merge 2 commits intoMichaelliv:mainfrom
bjesuiter:feat/vtt-support
Open

feat: add WebVTT converter#14
bjesuiter wants to merge 2 commits intoMichaelliv:mainfrom
bjesuiter:feat/vtt-support

Conversation

@bjesuiter
Copy link
Copy Markdown

@bjesuiter bjesuiter commented May 7, 2026

Hey there, human here!

I wanted my openclaw to build itself a skill to download YouTube video transcripts, and it did so by downloading a vtt file from YouTube and adding a small python script to convert that to markdown.

I thought it might be a great addition to markit to support vtt to markdown files, with deduplication of rolling subtitles as used by YouTube.

So I vibe coded this PR, if you have any remarks or complaints, send them my way, I'll fix it! :)

Example

Input sample.vtt:

WEBVTT

00:00:00.000 --> 00:00:02.000
Hello world.

00:00:02.000 --> 00:00:04.000
This is a caption test.

Run:

markit sample.vtt -q

Output:

# Transcript

## Text

Hello world. This is a caption test.

## Timestamped Transcript

- [00:00:00.000] Hello world.
- [00:00:02.000] This is a caption test.

YouTube-style rolling captions are deduplicated, so cumulative cue fragments become one readable transcript instead of repeated text.

@bjesuiter
Copy link
Copy Markdown
Author

Refinement pass pushed in 46971b9 (refactor: refine WebVTT parsing).

Summary:

  • Made .vtt extension matching case-insensitive (.VTT now works).
  • Made WebVTT MIME matching case-insensitive.
  • Simplified skipped WebVTT block handling with a shared prefix list.
  • Consolidated cue timestamp-tag stripping into one regex.
  • Improved HTML entity decoding, including numeric and hex entities such as 🐟.
  • Added test coverage for the new edge cases.

Verified locally:

  • bun run check
  • bun test (123 pass)
  • bun run build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant