aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/extractor/drtv.py
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2022-01-31 20:19:33 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2022-02-01 00:29:36 +0530
commit1d3586d0d513783e313428a6c57e18691a51f1fe (patch)
tree0097ad07eade89720e9c162640b4eef3e5bbfeac /yt_dlp/extractor/drtv.py
parentc533c89ce1d6965d8575413738d76a5bf9e2de59 (diff)
downloadhypervideo-pre-1d3586d0d513783e313428a6c57e18691a51f1fe.tar.lz
hypervideo-pre-1d3586d0d513783e313428a6c57e18691a51f1fe.tar.xz
hypervideo-pre-1d3586d0d513783e313428a6c57e18691a51f1fe.zip
[aes] Add unpad_pkcs7
Diffstat (limited to 'yt_dlp/extractor/drtv.py')
-rw-r--r--yt_dlp/extractor/drtv.py16
1 files changed, 6 insertions, 10 deletions
diff --git a/yt_dlp/extractor/drtv.py b/yt_dlp/extractor/drtv.py
index 70134204c..37e4d5b26 100644
--- a/yt_dlp/extractor/drtv.py
+++ b/yt_dlp/extractor/drtv.py
@@ -7,13 +7,11 @@ import re
from .common import InfoExtractor
-from ..aes import aes_cbc_decrypt
+from ..aes import aes_cbc_decrypt_bytes, unpad_pkcs7
from ..compat import compat_urllib_parse_unquote
from ..utils import (
- bytes_to_intlist,
ExtractorError,
int_or_none,
- intlist_to_bytes,
float_or_none,
mimetype2ext,
str_or_none,
@@ -191,13 +189,11 @@ class DRTVIE(InfoExtractor):
def decrypt_uri(e):
n = int(e[2:10], 16)
a = e[10 + n:]
- data = bytes_to_intlist(hex_to_bytes(e[10:10 + n]))
- key = bytes_to_intlist(hashlib.sha256(
- ('%s:sRBzYNXBzkKgnjj8pGtkACch' % a).encode('utf-8')).digest())
- iv = bytes_to_intlist(hex_to_bytes(a))
- decrypted = aes_cbc_decrypt(data, key, iv)
- return intlist_to_bytes(
- decrypted[:-decrypted[-1]]).decode('utf-8').split('?')[0]
+ data = hex_to_bytes(e[10:10 + n])
+ key = hashlib.sha256(('%s:sRBzYNXBzkKgnjj8pGtkACch' % a).encode('utf-8')).digest()
+ iv = hex_to_bytes(a)
+ decrypted = unpad_pkcs7(aes_cbc_decrypt_bytes(data, key, iv))
+ return decrypted.decode('utf-8').split('?')[0]
for asset in assets:
kind = asset.get('Kind')