streamlink: Incorrect AES key length (48 bytes)
Hello all,
I have the following problem when i am trying to download an encrypted m3u8 link(AES 128) :
[cli][info] Found matching plugin hls for URL https://cdn.spayee.in/spees/w/o/5b49b8f2e4b02ac9d5e71945/v/5bcd586ee4b04b639bfddcf2/u/5c28ab6fe4b0efa6ebda1830/t/857c9994539db0b48bd818abaa6bcaaa/p/assets/videos/2018/10/22/5bcd586ee4b04b639bfddcf2/hls_350k_.m3u8
[cli][info] Available streams: live (worst, best)
[cli][info] Opening stream: live (hls)
Exception in thread Thread-HLSStreamWriter:
Traceback (most recent call last):
File "threading.py", line 916, in _bootstrap_inner
File "D:\ww\streamlink1\packages\streamlink\stream\segmented.py", line 167, in run
self.write(segment, result)
File "D:\ww\streamlink1\packages\streamlink\stream\hls.py", line 124, in write
sequence.num)
File "D:\ww\streamlink1\packages\streamlink\stream\hls.py", line 80, in create_decryptor
return AES.new(self.key_data, AES.MODE_CBC, iv)
File "D:\ww\streamlink1\packages\Crypto\Cipher\AES.py", line 260, in new
return _create_cipher(sys.modules[__name__], key, mode, *args, **kwargs)
File "D:\ww\streamlink1\packages\Crypto\Cipher\__init__.py", line 130, in _create_cipher
return modes[mode](factory, **kwargs)
File "D:\ww\streamlink1\packages\Crypto\Cipher\_mode_cbc.py", line 232, in _create_cbc_cipher
cipher_state = factory._create_base_cipher(kwargs)
File "D:\ww\streamlink1\packages\Crypto\Cipher\AES.py", line 130, in _create_base_cipher
raise ValueError("Incorrect AES key length (%d bytes)" % len(key))
ValueError: Incorrect AES key length (48 bytes)
I hope somebody from here can help me.
Thanks!
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 1
- Comments: 18 (6 by maintainers)
the decrypt_key method is changed. (Note: pseudocode)
And the spka key is from web page’s javascript and may be dynamically generated.
Sample
spka = “YjM3ZGVhNWU4N2I1MTI2Yw==”
You can make a option like “–spayee-spka=xxx” to pass spka key to the this plugin.
A simple plugin implemention
save it to streamlink\plugins\spayee.py
Only tested under python 2.7