From edf65256aa630a5ce011138e8957c95c9bef0584 Mon Sep 17 00:00:00 2001 From: pukkandan Date: Sat, 18 Sep 2021 00:51:27 +0530 Subject: [PATCH] [hls,aes] Fallback to native implementation for AES-CBC and detect `Cryptodome` in addition to `Crypto` Closes #935 Related: #938 --- test/test_cookies.py | 4 ++-- yt_dlp/YoutubeDL.py | 4 ++-- yt_dlp/aes.py | 14 +++++++++++++- yt_dlp/compat.py | 10 ++++++++++ yt_dlp/cookies.py | 11 +++-------- yt_dlp/downloader/external.py | 10 ++-------- yt_dlp/downloader/fragment.py | 9 ++------- yt_dlp/downloader/hls.py | 7 ++----- yt_dlp/extractor/ivi.py | 26 ++++++++++---------------- 9 files changed, 46 insertions(+), 49 deletions(-) diff --git a/test/test_cookies.py b/test/test_cookies.py index 6faaaa0c9..6053ebb4e 100644 --- a/test/test_cookies.py +++ b/test/test_cookies.py @@ -2,8 +2,8 @@ import unittest from datetime import datetime, timezone from yt_dlp import cookies +from yt_dlp.compat import compat_pycrypto_AES from yt_dlp.cookies import ( - CRYPTO_AVAILABLE, LinuxChromeCookieDecryptor, MacChromeCookieDecryptor, WindowsChromeCookieDecryptor, @@ -53,7 +53,7 @@ class TestCookies(unittest.TestCase): decryptor = LinuxChromeCookieDecryptor('Chrome', YDLLogger()) self.assertEqual(decryptor.decrypt(encrypted_value), value) - @unittest.skipIf(not CRYPTO_AVAILABLE, 'cryptography library not available') + @unittest.skipIf(not compat_pycrypto_AES, 'cryptography library not available') def test_chrome_cookie_decryptor_windows_v10(self): with MonkeyPatch(cookies, { '_get_windows_v10_key': lambda *args, **kwargs: b'Y\xef\xad\xad\xeerp\xf0Y\xe6\x9b\x12\xc2