mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-17 21:59:17 +00:00
[letv] Speedup M3U8 decryption
This commit is contained in:
parent
b78b292f0c
commit
2ebd2eac88
|
@ -94,17 +94,16 @@ def decrypt_m3u8(encrypted_data):
|
||||||
return encrypted_data
|
return encrypted_data
|
||||||
encrypted_data = encrypted_data[5:]
|
encrypted_data = encrypted_data[5:]
|
||||||
|
|
||||||
_loc4_ = bytearray()
|
_loc4_ = bytearray(2 * len(encrypted_data))
|
||||||
while encrypted_data:
|
for idx, val in enumerate(encrypted_data):
|
||||||
b = compat_ord(encrypted_data[0])
|
b = compat_ord(val)
|
||||||
_loc4_.extend([b // 16, b & 0x0f])
|
_loc4_[2 * idx] = b // 16
|
||||||
encrypted_data = encrypted_data[1:]
|
_loc4_[2 * idx + 1] = b % 16
|
||||||
idx = len(_loc4_) - 11
|
idx = len(_loc4_) - 11
|
||||||
_loc4_ = _loc4_[idx:] + _loc4_[:idx]
|
_loc4_ = _loc4_[idx:] + _loc4_[:idx]
|
||||||
_loc7_ = bytearray()
|
_loc7_ = bytearray(len(encrypted_data))
|
||||||
while _loc4_:
|
for i in range(len(encrypted_data)):
|
||||||
_loc7_.append(_loc4_[0] * 16 + _loc4_[1])
|
_loc7_[i] = _loc4_[2 * i] * 16 + _loc4_[2 * i + 1]
|
||||||
_loc4_ = _loc4_[2:]
|
|
||||||
|
|
||||||
return bytes(_loc7_)
|
return bytes(_loc7_)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue