diff --git a/docs/configuration.rst b/docs/configuration.rst index 0ceca9fb538..5d5a2af38f2 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -1108,6 +1108,15 @@ Description Video `format selection =========== ===== +downloader.ytdl.forward-cookies +------------------------------- +=========== ===== +Type ``bool`` +Default ``true`` +Description Forward cookies to youtube-dl. +=========== ===== + + downloader.ytdl.logging ----------------------- =========== ===== diff --git a/docs/gallery-dl.conf b/docs/gallery-dl.conf index 2e448be4c0a..a4a9ee02f23 100644 --- a/docs/gallery-dl.conf +++ b/docs/gallery-dl.conf @@ -164,6 +164,7 @@ "ytdl": { "format": null, + "forward-cookies": true, "mtime": true, "rate": null, "retries": 4, diff --git a/gallery_dl/downloader/ytdl.py b/gallery_dl/downloader/ytdl.py index da57935829d..a2334873b60 100644 --- a/gallery_dl/downloader/ytdl.py +++ b/gallery_dl/downloader/ytdl.py @@ -34,12 +34,15 @@ def __init__(self, extractor, output): if self.config("logging", True): options["logger"] = self.log + self.forward_cookies = self.config("forward-cookies", True) self.ytdl = YoutubeDL(options) def download(self, url, pathfmt): - for cookie in self.session.cookies: - self.ytdl.cookiejar.set_cookie(cookie) + if self.forward_cookies: + set_cookie = self.ytdl.cookiejar.set_cookie + for cookie in self.session.cookies: + set_cookie(cookie) try: info_dict = self.ytdl.extract_info(url[5:], download=False)