From f1f158976e38d38a260762accafe7bbe6d451151 Mon Sep 17 00:00:00 2001 From: Stefan Lobbenmeier Date: Sat, 11 May 2024 19:25:39 +0200 Subject: [PATCH] [cookies] Get chrome session cookies with `--cookies-from-browser` (#9747) Partially addresses #5534 Authored by: StefanLobbenmeier --- yt_dlp/cookies.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/yt_dlp/cookies.py b/yt_dlp/cookies.py index 7b8d215f0..0de0672e1 100644 --- a/yt_dlp/cookies.py +++ b/yt_dlp/cookies.py @@ -347,6 +347,11 @@ def _process_chrome_cookie(decryptor, host_key, name, value, encrypted_value, pa if value is None: return is_encrypted, None + # In chrome, session cookies have expires_utc set to 0 + # In our cookie-store, cookies that do not expire should have expires set to None + if not expires_utc: + expires_utc = None + return is_encrypted, http.cookiejar.Cookie( version=0, name=name, value=value, port=None, port_specified=False, domain=host_key, domain_specified=bool(host_key), domain_initial_dot=host_key.startswith('.'),