From 3078f8140324c780a93cf86334ce065af8446079 Mon Sep 17 00:00:00 2001 From: cbaurtx Date: Sun, 14 Jul 2019 19:30:34 +0200 Subject: [PATCH] extend _parse_extinf to allow for #EXIINF tags like #EXTINF:-1 tvg-id=....., Title --- m3u8/parser.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/m3u8/parser.py b/m3u8/parser.py index ccd5696d..e5d0050f 100644 --- a/m3u8/parser.py +++ b/m3u8/parser.py @@ -187,11 +187,14 @@ def _parse_extinf(line, data, state, lineno, strict): chunks = line.replace(protocol.extinf + ':', '').split(',', 1) if len(chunks) == 2: duration, title = chunks + if not strict: + duration = re.search(r'^\s*-?\+?\d+\.?\d*', duration).group(0) elif len(chunks) == 1: if strict: raise ParseError(lineno, line) else: duration = chunks[0] + duration = re.search(r'^\s*-?\+?\d+\.?\d*', duration).group(0) title = '' if 'segment' not in state: state['segment'] = {}