kev_value_parts = part.strip().split("=")
stream_info[kev_value_parts[0]] = kev_value_parts[1]
elif line.startswith("#EXT-X-KEY:"):
- key = line.split(",URI=")[1].strip('"')
+ # Extract encryption key URI if present
+ # METHOD=NONE means no encryption, so explicitly clear the key
+ if "METHOD=NONE" in line:
+ key = None
+ elif ",URI=" in line:
+ key = line.split(",URI=")[1].strip('"')
elif line.startswith("#"):
# Ignore other extensions
continue