diff options
Diffstat (limited to 'gallery_dl/downloader/ytdl.py')
| -rw-r--r-- | gallery_dl/downloader/ytdl.py | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/gallery_dl/downloader/ytdl.py b/gallery_dl/downloader/ytdl.py index 9ef8816..a56a6be 100644 --- a/gallery_dl/downloader/ytdl.py +++ b/gallery_dl/downloader/ytdl.py @@ -11,6 +11,7 @@ from .common import DownloaderBase from .. import ytdl, text from xml.etree import ElementTree +from http.cookiejar import Cookie import os @@ -85,7 +86,8 @@ class YoutubeDLDownloader(DownloaderBase): info_dict = self._extract_manifest( ytdl_instance, url, manifest, kwdict.pop("_ytdl_manifest_data", None), - kwdict.pop("_ytdl_manifest_headers", None)) + kwdict.pop("_ytdl_manifest_headers", None), + kwdict.pop("_ytdl_manifest_cookies", None)) else: info_dict = self._extract_info(ytdl_instance, url) except Exception as exc: @@ -194,10 +196,21 @@ class YoutubeDLDownloader(DownloaderBase): return ytdl.extract_info(url, download=False) def _extract_manifest(self, ytdl, url, manifest_type, manifest_data=None, - headers=None): + headers=None, cookies=None): extr = ytdl.get_info_extractor("Generic") video_id = extr._generic_id(url) + if cookies is not None: + if isinstance(cookies, dict): + cookies = cookies.items() + set_cookie = ytdl.cookiejar.set_cookie + for name, value in cookies: + set_cookie(Cookie( + 0, name, value, None, False, + "", False, False, "/", False, + False, None, False, None, None, {}, + )) + if manifest_type == "hls": if manifest_data is None: try: |
