Skip to content

Commit

Permalink
extend _parse_extinf to allow for #EXIINF tags like #EXTINF:-1 tvg-id…
Browse files Browse the repository at this point in the history
…=....., Title
  • Loading branch information
cbaurtx committed Jul 14, 2019
1 parent a84b2ac commit 3078f81
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions m3u8/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'] = {}
Expand Down

0 comments on commit 3078f81

Please sign in to comment.