[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
3 changed files with 15 additions and 2 deletions

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)