You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am currently looking into parsing some m3u8 files, but these playlist.m3u8 and video.m3u8 files are encrypted.
I do have the encryption key and the GET requests return the IV and the encrypted playlist in the format: <IV hex>:<encrypted m3u8 data hex>.
I have manually decrypted the playlist using basically something like this:
try:
# Split the hex string by coloniv_hex, encrypted_data_hex=encrypted_hex.split(":")
# Convert hex strings to bytesself.iv=bytes.fromhex(iv_hex)
encrypted_data=bytes.fromhex(encrypted_data_hex)
encryption_key=bytes.fromhex(self.encryption_key_hex)
# Initialize AES cipher in CBC modecipher=AES.new(encryption_key, AES.MODE_CBC, self.iv)
# Decrypt and unpad the datadecrypted_data=unpad(cipher.decrypt(encrypted_data), AES.block_size)
# Decode to stringself.decrypted_content=decrypted_data.decode("utf-8")
returnself.decrypted_contentexceptExceptionase:
print(f"Error decrypting data: {e}")
returnNone
and while I can keep using it, it would be nice if m3u8 supported this sort of thing via load?
BTW: the content of the site I am getting this from is not DRM protected; it's just the playlist.m3u8 and video.m3u8 that is.
If this discussion is not allowed here, feel free to delete my issue.
Thank you!
The text was updated successfully, but these errors were encountered:
I've run into this as well, but I think playlist decryption should be out of scope for this library — it would require a binary dependency, which would be a big shift. Also, encrypted playlist is not part of the 8216 RFC (whereas encrypted segments are).
Yeah, I understand that and in my script I already worked around it by decrypting it and then using m3u8.loads.
Perhaps it'd be possible to allow a custom function (e.g. preprocess_downloaded_playlist_func), which - if set (and None by default) would let a developer preprocess the downloaded data before it is parsed (e.g. in
This would allow me to write one decryption function, that takes the content, splits it by the colon and decrypts the second argument, ultimately setting it as the actual content.
Hello and thank you for making this library!
I am currently looking into parsing some m3u8 files, but these
playlist.m3u8
andvideo.m3u8
files are encrypted.I do have the encryption key and the GET requests return the IV and the encrypted playlist in the format:
<IV hex>:<encrypted m3u8 data hex>
.I have manually decrypted the playlist using basically something like this:
and while I can keep using it, it would be nice if
m3u8
supported this sort of thing viaload
?BTW: the content of the site I am getting this from is not DRM protected; it's just the
playlist.m3u8
andvideo.m3u8
that is.If this discussion is not allowed here, feel free to delete my issue.
Thank you!
The text was updated successfully, but these errors were encountered: