Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty cue blocks cannot be parsed #2

Open
bwkimmel opened this issue Nov 25, 2024 · 0 comments · May be fixed by #3
Open

Empty cue blocks cannot be parsed #2

bwkimmel opened this issue Nov 25, 2024 · 0 comments · May be fixed by #3

Comments

@bwkimmel
Copy link

According to the spec, the payload of a WebVTT cue block consists of one of three options, the first one being WebVTT caption or subtitle cue text, which, in turn, consists of "zero or more WebVTT caption or subtitle cue components, in any order, each optionally separated from the next by a WebVTT line terminator."

Therefore, an empty cue block is valid. In practice, I've encountered several Youtube videos that have such empty cue blocks.

To modify an example from the test cases, the following valid WebVTT file fails to parse:

WEBVTT

00:01.000 --> 00:04.000
- Never drink liquid nitrogen.

00:04.000 --> 00:05.000


00:05.000 --> 00:09.000
- It will perforate your stomach.
- You could die.

Attempting to parse this yields the following error:

ParseError { location: LineCol { line: 7, column: 1, offset: 88 }, expected: ExpectedSet { expected: {"[' ' | '\\t']", "['0' ..= '9']"} } }
bwkimmel added a commit to bwkimmel/subtp that referenced this issue Nov 25, 2024
Fixes mochi-neko#2

Note that this also allows empty comments, and "below"-style comments
that begin with whitespace, neither of which are forbidden by the spec:
https://www.w3.org/TR/webvtt1/#introduction-comments
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 a pull request may close this issue.

1 participant