diff options
author | pukkandan <pukkandan.ytdlp@gmail.com> | 2021-09-04 07:52:16 +0530 |
---|---|---|
committer | pukkandan <pukkandan.ytdlp@gmail.com> | 2021-09-04 07:52:47 +0530 |
commit | f9be9cb9fd8e85504735a6c60f4d7a2332764d05 (patch) | |
tree | 4819cb4f9d07c718d4adabce6da4889d031a343f /yt_dlp/cookies.py | |
parent | 4614bc22c1003a0b63ec6ed9c1a5d12a3e0cf05a (diff) | |
download | hypervideo-pre-f9be9cb9fd8e85504735a6c60f4d7a2332764d05.tar.lz hypervideo-pre-f9be9cb9fd8e85504735a6c60f4d7a2332764d05.tar.xz hypervideo-pre-f9be9cb9fd8e85504735a6c60f4d7a2332764d05.zip |
[cookies] Print warning for cookie decoding error only once
Closes #889
Diffstat (limited to 'yt_dlp/cookies.py')
-rw-r--r-- | yt_dlp/cookies.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/yt_dlp/cookies.py b/yt_dlp/cookies.py index c28833159..74219a8f7 100644 --- a/yt_dlp/cookies.py +++ b/yt_dlp/cookies.py @@ -559,7 +559,7 @@ def _parse_safari_cookies_record(data, jar, logger): p.skip_to(value_offset) value = p.read_cstring() except UnicodeDecodeError: - logger.warning('failed to parse cookie because UTF-8 decoding failed') + logger.warning('failed to parse cookie because UTF-8 decoding failed', only_once=True) return record_size p.skip_to(record_size, 'space at the end of the record') @@ -655,7 +655,7 @@ def _decrypt_aes_cbc(ciphertext, key, logger, initialization_vector=b' ' * 16): try: return intlist_to_bytes(plaintext[:-padding_length]).decode('utf-8') except UnicodeDecodeError: - logger.warning('failed to decrypt cookie because UTF-8 decoding failed. Possibly the key is wrong?') + logger.warning('failed to decrypt cookie because UTF-8 decoding failed. Possibly the key is wrong?', only_once=True) return None @@ -664,13 +664,13 @@ def _decrypt_aes_gcm(ciphertext, key, nonce, authentication_tag, logger): try: plaintext = cipher.decrypt_and_verify(ciphertext, authentication_tag) except ValueError: - logger.warning('failed to decrypt cookie because the MAC check failed. Possibly the key is wrong?') + logger.warning('failed to decrypt cookie because the MAC check failed. Possibly the key is wrong?', only_once=True) return None try: return plaintext.decode('utf-8') except UnicodeDecodeError: - logger.warning('failed to decrypt cookie because UTF-8 decoding failed. Possibly the key is wrong?') + logger.warning('failed to decrypt cookie because UTF-8 decoding failed. Possibly the key is wrong?', only_once=True) return None @@ -698,7 +698,7 @@ def _decrypt_windows_dpapi(ciphertext, logger): ctypes.byref(blob_out) # pDataOut ) if not ret: - logger.warning('failed to decrypt with DPAPI') + logger.warning('failed to decrypt with DPAPI', only_once=True) return None result = ctypes.string_at(blob_out.pbData, blob_out.cbData) |