diff options
author | TSRBerry <20988865+TSRBerry@users.noreply.github.com> | 2023-11-29 00:20:06 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-29 04:50:06 +0530 |
commit | 15f22b4880b6b3f71f350c64d70976ae65b9f1ca (patch) | |
tree | 9be50651f8db4927f39ed7542ce3bea75f9d4b62 | |
parent | 9751a457cfdb18bf99d9ee0d10e4e6a594502bbf (diff) |
[webvtt] Allow spaces before newlines for CueBlock (#7681)
Closes #7453
Ref: https://www.w3.org/TR/webvtt1/#webvtt-cue-block
-rw-r--r-- | yt_dlp/webvtt.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/yt_dlp/webvtt.py b/yt_dlp/webvtt.py index dd7298277..596e9bf73 100644 --- a/yt_dlp/webvtt.py +++ b/yt_dlp/webvtt.py @@ -95,6 +95,7 @@ _REGEX_TS = re.compile(r'''(?x) _REGEX_EOF = re.compile(r'\Z') _REGEX_NL = re.compile(r'(?:\r\n|[\r\n]|$)') _REGEX_BLANK = re.compile(r'(?:\r\n|[\r\n])+') +_REGEX_OPTIONAL_WHITESPACE = re.compile(r'[ \t]*') def _parse_ts(ts): @@ -285,6 +286,7 @@ class CueBlock(Block): m1 = parser.consume(_REGEX_TS) if not m1: return None + parser.consume(_REGEX_OPTIONAL_WHITESPACE) m2 = parser.consume(cls._REGEX_SETTINGS) if not parser.consume(_REGEX_NL): return None |