File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -288,15 +288,21 @@ def _decode_m3u8_mouflon_files(m3u8_text: str) -> str:
288288
289289def _extract_psch_and_pkey (m3u8_text ):
290290 """Return (psch_version, pkey) from #EXT-X-MOUFLON:PSCH line if present."""
291+ psch_lines = []
291292 for line in m3u8_text .splitlines ():
292293 l = line .strip ()
293294 if not l :
294295 continue
295296 if l .upper ().startswith ('#EXT-X-MOUFLON:PSCH' ):
296- parts = l .split (':' , 3 )
297- version = parts [2 ].lower () if len (parts ) > 2 else ''
298- pkey = parts [3 ] if len (parts ) > 3 else ''
299- return version , pkey
297+ psch_lines .append (l )
298+ if psch_lines :
299+ # Use the last (second) PSCH line if multiple are found
300+ last_line = psch_lines [- 1 ]
301+ parts = last_line .split (':' , 3 )
302+ version = parts [2 ].lower () if len (parts ) > 2 else ''
303+ pkey = parts [3 ] if len (parts ) > 3 else ''
304+ return version , pkey
305+
300306 return '' , ''
301307
302308def _make_absolute (base , ref ):
You can’t perform that action at this time.
0 commit comments