From 22b6fe46b399cd3a24a8a59efbb545e7641d1a07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Guzm=C3=A1n?= Date: Sat, 7 Feb 2026 16:42:52 -0600 Subject: [PATCH] yt-dlp: add missing patch --- ..._parsing_more_lentient_on_python3.12.patch | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 helpers/DATA/yt-dlp/patch_changes/002-make_cookies_parsing_more_lentient_on_python3.12.patch diff --git a/helpers/DATA/yt-dlp/patch_changes/002-make_cookies_parsing_more_lentient_on_python3.12.patch b/helpers/DATA/yt-dlp/patch_changes/002-make_cookies_parsing_more_lentient_on_python3.12.patch new file mode 100644 index 0000000..895c8f1 --- /dev/null +++ b/helpers/DATA/yt-dlp/patch_changes/002-make_cookies_parsing_more_lentient_on_python3.12.patch @@ -0,0 +1,35 @@ +diff --git a/yt_dlp/cookies.py b/yt_dlp/cookies.py +index 8c05a09f..8b6f6613 100644 +--- a/yt_dlp/cookies.py ++++ b/yt_dlp/cookies.py +@@ -1238,15 +1238,27 @@ def load(self, data): + else: + value, _ = self.value_decode(value) + +- morsel[key] = value ++ try: ++ morsel[key] = value ++ except http.cookies.CookieError: ++ # Lenient mode: ignore invalid attributes ++ pass + + elif is_attribute: + morsel = None + + elif value is not None: +- morsel = self.get(key, http.cookies.Morsel()) ++ morsel = self.get(key) or http.cookies.Morsel() + real_value, coded_value = self.value_decode(value) +- morsel.set(key, real_value, coded_value) ++ try: ++ morsel.set(key, real_value, coded_value) ++ except http.cookies.CookieError: ++ # Python 3.12+ rejects control characters in cookies. ++ # LenientSimpleCookie should accept them (yt-dlp tests expect this), so ++ # bypass Morsel.set() validation, assign underlying fields to read-only props. ++ morsel._key = key ++ morsel._value = real_value ++ morsel._coded_value = coded_value + self[key] = morsel + + else: