1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-09-03 16:45:17 +00:00

[cookies] Allow cookiefile to be a text stream

Closes #3674
This commit is contained in:
pukkandan
2022-05-10 11:44:45 +05:30
parent fe1daad3cb
commit d76fa1f3d4
3 changed files with 28 additions and 5 deletions

View File

@ -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)