mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-29 06:55:25 +00:00
parent
eab3f867e2
commit
81a136b80f
@ -89,8 +89,12 @@ class ParseError(Exception):
|
|||||||
))
|
))
|
||||||
|
|
||||||
|
|
||||||
|
# While the specification <https://www.w3.org/TR/webvtt1/#webvtt-timestamp>
|
||||||
|
# prescribes that hours must be *2 or more* digits, timestamps with a single
|
||||||
|
# digit for the hour part has been seen in the wild.
|
||||||
|
# See https://github.com/yt-dlp/yt-dlp/issues/921
|
||||||
_REGEX_TS = re.compile(r'''(?x)
|
_REGEX_TS = re.compile(r'''(?x)
|
||||||
(?:([0-9]{2,}):)?
|
(?:([0-9]{1,}):)?
|
||||||
([0-9]{2}):
|
([0-9]{2}):
|
||||||
([0-9]{2})\.
|
([0-9]{2})\.
|
||||||
([0-9]{3})?
|
([0-9]{3})?
|
||||||
@ -172,6 +176,7 @@ class Magic(HeaderBlock):
|
|||||||
_REGEX_TSMAP = re.compile(r'X-TIMESTAMP-MAP=')
|
_REGEX_TSMAP = re.compile(r'X-TIMESTAMP-MAP=')
|
||||||
_REGEX_TSMAP_LOCAL = re.compile(r'LOCAL:')
|
_REGEX_TSMAP_LOCAL = re.compile(r'LOCAL:')
|
||||||
_REGEX_TSMAP_MPEGTS = re.compile(r'MPEGTS:([0-9]+)')
|
_REGEX_TSMAP_MPEGTS = re.compile(r'MPEGTS:([0-9]+)')
|
||||||
|
_REGEX_TSMAP_SEP = re.compile(r'[ \t]*,[ \t]*')
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def __parse_tsmap(cls, parser):
|
def __parse_tsmap(cls, parser):
|
||||||
@ -194,7 +199,7 @@ class Magic(HeaderBlock):
|
|||||||
raise ParseError(parser)
|
raise ParseError(parser)
|
||||||
else:
|
else:
|
||||||
raise ParseError(parser)
|
raise ParseError(parser)
|
||||||
if parser.consume(','):
|
if parser.consume(cls._REGEX_TSMAP_SEP):
|
||||||
continue
|
continue
|
||||||
if parser.consume(_REGEX_NL):
|
if parser.consume(_REGEX_NL):
|
||||||
break
|
break
|
||||||
|
Loading…
Reference in New Issue
Block a user