aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/YoutubeDL.py
diff options
context:
space:
mode:
authorMatt Broadway <mattdbway@gmail.com>2021-07-21 21:32:49 +0100
committerGitHub <noreply@github.com>2021-07-22 02:02:49 +0530
commit982ee69a742347efe91acb12df1f14ba5c7f65dd (patch)
tree31c41031b709ef51915edc0fa3a6f4b58a6b8554 /yt_dlp/YoutubeDL.py
parent7ea654112425d05227dde972a869d5507c685b4b (diff)
downloadhypervideo-pre-982ee69a742347efe91acb12df1f14ba5c7f65dd.tar.lz
hypervideo-pre-982ee69a742347efe91acb12df1f14ba5c7f65dd.tar.xz
hypervideo-pre-982ee69a742347efe91acb12df1f14ba5c7f65dd.zip
Add option `--cookies-from-browser` to load cookies from a browser (#488)
* also adds `--no-cookies-from-browser` Original PR: https://github.com/ytdl-org/youtube-dl/pull/29201 Authored by: mbway
Diffstat (limited to 'yt_dlp/YoutubeDL.py')
-rw-r--r--yt_dlp/YoutubeDL.py15
1 files changed, 6 insertions, 9 deletions
diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.py
index 3ab59ea31..594886506 100644
--- a/yt_dlp/YoutubeDL.py
+++ b/yt_dlp/YoutubeDL.py
@@ -31,7 +31,6 @@ from zipimport import zipimporter
from .compat import (
compat_basestring,
- compat_cookiejar,
compat_get_terminal_size,
compat_kwargs,
compat_numeric_types,
@@ -42,6 +41,7 @@ from .compat import (
compat_urllib_request,
compat_urllib_request_DataHandler,
)
+from .cookies import load_cookies
from .utils import (
age_restricted,
args_to_str,
@@ -110,7 +110,6 @@ from .utils import (
version_tuple,
write_json_file,
write_string,
- YoutubeDLCookieJar,
YoutubeDLCookieProcessor,
YoutubeDLHandler,
YoutubeDLRedirectHandler,
@@ -290,6 +289,9 @@ class YoutubeDL(object):
break_on_reject: Stop the download process when encountering a video that
has been filtered out.
cookiefile: File name where cookies should be read from and dumped to
+ cookiesfrombrowser: A tuple containing the name of the browser and the profile
+ name/path from where cookies are loaded.
+ Eg: ('chrome', ) or (vivaldi, 'default')
nocheckcertificate:Do not verify SSL certificates
prefer_insecure: Use HTTP instead of HTTPS to retrieve information.
At the moment, this is only supported by YouTube.
@@ -3211,16 +3213,11 @@ class YoutubeDL(object):
timeout_val = self.params.get('socket_timeout')
self._socket_timeout = 600 if timeout_val is None else float(timeout_val)
+ opts_cookiesfrombrowser = self.params.get('cookiesfrombrowser')
opts_cookiefile = self.params.get('cookiefile')
opts_proxy = self.params.get('proxy')
- if opts_cookiefile is None:
- self.cookiejar = compat_cookiejar.CookieJar()
- else:
- opts_cookiefile = expand_path(opts_cookiefile)
- self.cookiejar = YoutubeDLCookieJar(opts_cookiefile)
- if os.access(opts_cookiefile, os.R_OK):
- self.cookiejar.load(ignore_discard=True, ignore_expires=True)
+ self.cookiejar = load_cookies(opts_cookiefile, opts_cookiesfrombrowser, self)
cookie_processor = YoutubeDLCookieProcessor(self.cookiejar)
if opts_proxy is not None: