-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
ValueError: Incorrect AES key length (260 bytes) #3701
Copy link
Copy link
Closed
Labels
Description
Plugin Issue
- [x ] This is a plugin issue and I have read the contribution guidelines.
- [x ] I am using the latest development version from the master branch.
Description
I am trying to download a few free introduction video from a paid site, which are hosted on an S3 Bubble server, but somehow the encryption key is not being read correctly. My understanding is that the key should be 16 bytes but this one shows 260 bytes (very odd number). Is there a workaround for this? The key can be retrieved but maybe needs to be converted (or decrypted) down to 16 bytes maybe?
Reproduction steps / Explicit stream URLs to test
- I installed Streamlink via brew on Terminal
- Entered the following:
streamlink https://d1tlsva54vi89q.cloudfront.net/b67e8bb3-8ac6-4dae-bb89-3d6ebf3df59c/master_Ott_Hls_Ts_Avc_Aac_16x9_1920x1080p_30Hz_8500Kbps.m3u8 best -o output.mp4
Log output
[cli][debug] OS: macOS 11.2.3
[cli][debug] Python: 3.9.4
[cli][debug] Streamlink: 2.1.1
[cli][debug] Requests(2.25.1), Socks(1.7.1), Websocket(0.58.0)
[cli][debug] Arguments:
[cli][debug] url=https://d1tlsva54vi89q.cloudfront.net/b67e8bb3-8ac6-4dae-bb89-3d6ebf3df59c/master_Ott_Hls_Ts_Avc_Aac_16x9_1920x1080p_30Hz_8500Kbps.m3u8
[cli][debug] stream=['best']
[cli][debug] --loglevel=debug
[cli][debug] --output=output.mp4
[cli][info] Found matching plugin hls for URL https://d1tlsva54vi89q.cloudfront.net/b67e8bb3-8ac6-4dae-bb89-3d6ebf3df59c/master_Ott_Hls_Ts_Avc_Aac_16x9_1920x1080p_30Hz_8500Kbps.m3u8
[plugins.hls][debug] URL=https://d1tlsva54vi89q.cloudfront.net/b67e8bb3-8ac6-4dae-bb89-3d6ebf3df59c/master_Ott_Hls_Ts_Avc_Aac_16x9_1920x1080p_30Hz_8500Kbps.m3u8; params={}
[utils.l10n][debug] Language code: en_US
[cli][info] Available streams: live (worst, best)
[cli][info] Opening stream: live (hls)
[stream.hls][debug] Reloading playlist
[stream.hls][debug] Segments in this playlist are encrypted
[stream.hls][debug] First Sequence: 1; Last Sequence: 75
[stream.hls][debug] Start offset: 0; Duration: None; Start Sequence: 1; End Sequence: 75
[stream.hls][debug] Adding segment 1 to queue
[cli][debug] Pre-buffering 8192 bytes
[stream.hls][debug] Adding segment 2 to queue
[stream.hls][debug] Adding segment 3 to queue
[stream.hls][debug] Adding segment 4 to queue
[stream.hls][debug] Adding segment 5 to queue
[stream.hls][debug] Adding segment 6 to queue
[stream.hls][debug] Adding segment 7 to queue
[stream.hls][debug] Adding segment 8 to queue
[stream.hls][debug] Adding segment 9 to queue
[stream.hls][debug] Adding segment 10 to queue
[stream.hls][debug] Adding segment 11 to queue
[stream.hls][debug] Adding segment 12 to queue
[stream.hls][debug] Adding segment 13 to queue
[stream.hls][debug] Adding segment 14 to queue
[stream.hls][debug] Adding segment 15 to queue
[stream.hls][debug] Adding segment 16 to queue
[stream.hls][debug] Adding segment 17 to queue
[stream.hls][debug] Adding segment 18 to queue
[stream.hls][debug] Adding segment 19 to queue
[stream.hls][debug] Adding segment 20 to queue
[stream.hls][debug] Adding segment 21 to queue
[stream.hls][debug] Adding segment 22 to queue
Exception in thread Thread-HLSStreamWriter:
Traceback (most recent call last):
File "/usr/local/Cellar/python@3.9/3.9.4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/threading.py", line 954, in _bootstrap_inner
self.run()
File "/usr/local/Cellar/streamlink/2.1.1_1/libexec/lib/python3.9/site-packages/streamlink/stream/segmented.py", line 189, in run
self.write(segment, result)
File "/usr/local/Cellar/streamlink/2.1.1_1/libexec/lib/python3.9/site-packages/streamlink/stream/hls.py", line 135, in write
return self._write(sequence, *args, **kwargs)
File "/usr/local/Cellar/streamlink/2.1.1_1/libexec/lib/python3.9/site-packages/streamlink/stream/hls.py", line 150, in _write
decryptor = self.create_decryptor(sequence.segment.key,
File "/usr/local/Cellar/streamlink/2.1.1_1/libexec/lib/python3.9/site-packages/streamlink/stream/hls.py", line 91, in create_decryptor
return AES.new(self.key_data, AES.MODE_CBC, iv)
File "/usr/local/Cellar/streamlink/2.1.1_1/libexec/lib/python3.9/site-packages/Crypto/Cipher/AES.py", line 232, in new
return _create_cipher(sys.modules[__name__], key, mode, *args, **kwargs)
File "/usr/local/Cellar/streamlink/2.1.1_1/libexec/lib/python3.9/site-packages/Crypto/Cipher/__init__.py", line 79, in _create_cipher
return modes[mode](factory, **kwargs)
File "/usr/local/Cellar/streamlink/2.1.1_1/libexec/lib/python3.9/site-packages/Crypto/Cipher/_mode_cbc.py", line 274, in _create_cbc_cipher
cipher_state = factory._create_base_cipher(kwargs)
File "/usr/local/Cellar/streamlink/2.1.1_1/libexec/lib/python3.9/site-packages/Crypto/Cipher/AES.py", line 93, in _create_base_cipher
raise ValueError("Incorrect AES key length (%d bytes)" % len(key))
ValueError: Incorrect AES key length (256 bytes)
[stream.segmented][debug] Closing worker thread
[stream.segmented][debug] Closing writer thread
[cli][error] Try 1/1: Could not open stream <HLSStream('https://d1tlsva54vi89q.cloudfront.net/b67e8bb3-8ac6-4dae-bb89-3d6ebf3df59c/master_Ott_Hls_Ts_Avc_Aac_16x9_1920x1080p_30Hz_8500Kbps.m3u8', None)> (Failed to read data from stream: Read timeout)
error: Could not open stream <HLSStream('https://d1tlsva54vi89q.cloudfront.net/b67e8bb3-8ac6-4dae-bb89-3d6ebf3df59c/master_Ott_Hls_Ts_Avc_Aac_16x9_1920x1080p_30Hz_8500Kbps.m3u8', None)>, tried 1 times, exiting
[cli][info] Closing currently open stream...
Additional comments, etc.
Any help would be appreciated.
Love Streamlink? Please consider supporting our collective. Thanks!
Reactions are currently unavailable