aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/cookies.py
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2022-05-10 11:44:45 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2022-05-11 05:52:55 +0530
commitd76fa1f3d4f559e82a4c54e6f8feb0727ffc4b58 (patch)
tree5a9e1d45dbf612d94a767c0945f28057502eba95 /yt_dlp/cookies.py
parentfe1daad3cb224904cc72462204da5f6427be6f44 (diff)
downloadhypervideo-pre-d76fa1f3d4f559e82a4c54e6f8feb0727ffc4b58.tar.lz
hypervideo-pre-d76fa1f3d4f559e82a4c54e6f8feb0727ffc4b58.tar.xz
hypervideo-pre-d76fa1f3d4f559e82a4c54e6f8feb0727ffc4b58.zip
[cookies] Allow `cookiefile` to be a text stream
Closes #3674
Diffstat (limited to 'yt_dlp/cookies.py')
-rw-r--r--yt_dlp/cookies.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/yt_dlp/cookies.py b/yt_dlp/cookies.py
index b06edfc5d..c6edaebe4 100644
--- a/yt_dlp/cookies.py
+++ b/yt_dlp/cookies.py
@@ -83,9 +83,12 @@ def load_cookies(cookie_file, browser_specification, ydl):
cookie_jars.append(extract_cookies_from_browser(browser_name, profile, YDLLogger(ydl), keyring=keyring))
if cookie_file is not None:
- cookie_file = expand_path(cookie_file)
+ is_filename = YoutubeDLCookieJar.is_path(cookie_file)
+ if is_filename:
+ cookie_file = expand_path(cookie_file)
+
jar = YoutubeDLCookieJar(cookie_file)
- if os.access(cookie_file, os.R_OK):
+ if not is_filename or os.access(cookie_file, os.R_OK):
jar.load(ignore_discard=True, ignore_expires=True)
cookie_jars.append(jar)