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:
parent
d9d44ad953
commit
547ea71463
@ -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
|
||||
-----------------------
|
||||
=========== =====
|
||||
|
@ -164,6 +164,7 @@
|
||||
"ytdl":
|
||||
{
|
||||
"format": null,
|
||||
"forward-cookies": true,
|
||||
"mtime": true,
|
||||
"rate": null,
|
||||
"retries": 4,
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user