webvtt-py icon indicating copy to clipboard operation
webvtt-py copied to clipboard

Cue skipped when empty line follows timing in multi-line cues

Open SHi-ON opened this issue 7 months ago • 0 comments

When using webvtt.read(vtt_file_path) to parse WebVTT files, I've observed that if there is a blank (empty) line immediately following the cue timing, the actual subtitle text on the next line is not included in the output. For example:

00:02:36.420 --> 00:02:42.699

congratulations

In this scenario, the text "congratulations" is not parsed as part of the cue.

Reason

The current parser seems to expect subtitle text to appear directly after the timing line. If there is a blank line immediately after the timing, the parser treats the cue as empty and skips any text that follows.

Suggestion

The parser should ignore any empty lines that appear immediately after the timing line, and include all following non-empty lines as the cue text, to better handle cases allowed by the WebVTT specification.

Sample

As a multi-line sample, you can take this file to reproduce this issue.

SHi-ON avatar Jun 12 '25 04:06 SHi-ON