1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-25 04:02:32 +01:00

[downloader.ytdl] add 'forward-cookies' option (#352)

The "long" name is necessary because just calling it 'cookies' would
clash with how the lookup for '--cookies' is implemented.
This commit is contained in:
Mike Fährmann 2019-07-24 21:19:11 +02:00
parent d9d44ad953
commit 547ea71463
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
3 changed files with 15 additions and 2 deletions

View File

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

View File

@ -164,6 +164,7 @@
"ytdl":
{
"format": null,
"forward-cookies": true,
"mtime": true,
"rate": null,
"retries": 4,

View File

@ -34,12 +34,15 @@ class YoutubeDLDownloader(DownloaderBase):
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)