[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:
@@ -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
|
downloader.ytdl.logging
|
||||||
-----------------------
|
-----------------------
|
||||||
=========== =====
|
=========== =====
|
||||||
|
|||||||
@@ -164,6 +164,7 @@
|
|||||||
"ytdl":
|
"ytdl":
|
||||||
{
|
{
|
||||||
"format": null,
|
"format": null,
|
||||||
|
"forward-cookies": true,
|
||||||
"mtime": true,
|
"mtime": true,
|
||||||
"rate": null,
|
"rate": null,
|
||||||
"retries": 4,
|
"retries": 4,
|
||||||
|
|||||||
@@ -34,12 +34,15 @@ class YoutubeDLDownloader(DownloaderBase):
|
|||||||
|
|
||||||
if self.config("logging", True):
|
if self.config("logging", True):
|
||||||
options["logger"] = self.log
|
options["logger"] = self.log
|
||||||
|
self.forward_cookies = self.config("forward-cookies", True)
|
||||||
|
|
||||||
self.ytdl = YoutubeDL(options)
|
self.ytdl = YoutubeDL(options)
|
||||||
|
|
||||||
def download(self, url, pathfmt):
|
def download(self, url, pathfmt):
|
||||||
for cookie in self.session.cookies:
|
if self.forward_cookies:
|
||||||
self.ytdl.cookiejar.set_cookie(cookie)
|
set_cookie = self.ytdl.cookiejar.set_cookie
|
||||||
|
for cookie in self.session.cookies:
|
||||||
|
set_cookie(cookie)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
info_dict = self.ytdl.extract_info(url[5:], download=False)
|
info_dict = self.ytdl.extract_info(url[5:], download=False)
|
||||||
|
|||||||
Reference in New Issue
Block a user