From 3337739ba892550b347aba8676d937bc1eb07329 Mon Sep 17 00:00:00 2001 From: Forthrin Date: Wed, 10 Apr 2019 19:01:17 +0200 Subject: [PATCH] [nrk] Gracefully handle subtitle thousands with less than three digits --- youtube_dl/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index 79d17cd12..eb4631b26 100644 --- a/youtube_dl/utils.py +++ b/youtube_dl/utils.py @@ -2729,9 +2729,9 @@ def parse_dfxp_time_expr(time_expr): if mobj: return float(mobj.group('time_offset')) - mobj = re.match(r'^(\d+):(\d\d):(\d\d(?:(?:\.|:)\d+)?)$', time_expr) + mobj = re.match(r'^(\d+):(\d\d):(\d\d)\.(\d{1,3})$', time_expr) if mobj: - return 3600 * int(mobj.group(1)) + 60 * int(mobj.group(2)) + float(mobj.group(3).replace(':', '.')) + return 3600 * int(mobj.group(1)) + 60 * int(mobj.group(2)) + int(mobj.group(3)) + float("%03d" % int(mobj.group(4))) / 1000 def srt_subtitles_timecode(seconds):