diff --git a/gallery_dl/downloader/ytdl.py b/gallery_dl/downloader/ytdl.py index 950a72f6..26f328dd 100644 --- a/gallery_dl/downloader/ytdl.py +++ b/gallery_dl/downloader/ytdl.py @@ -62,10 +62,18 @@ class YoutubeDLDownloader(DownloaderBase): info_dict = kwdict.pop("_ytdl_info_dict", None) if not info_dict: + url = url[5:] try: - info_dict = ytdl_instance.extract_info(url[5:], download=False) + manifest = kwdict.pop("_ytdl_manifest", None) + if manifest: + info_dict = self._extract_manifest( + ytdl_instance, url, manifest) + else: + info_dict = self._extract_info(ytdl_instance, url) except Exception as exc: self.log.debug("", exc_info=exc) + self.log.warning("%s: %s", exc.__class__.__name__, exc) + if not info_dict: return False @@ -134,6 +142,42 @@ class YoutubeDLDownloader(DownloaderBase): ytdl_instance.process_info(entry) return True + def _extract_info(self, ytdl, url): + return ytdl.extract_info(url, download=False) + + def _extract_manifest(self, ytdl, url, manifest): + extr = ytdl.get_info_extractor("Generic") + video_id = extr._generic_id(url) + + if manifest == "hls": + try: + formats, subtitles = extr._extract_m3u8_formats_and_subtitles( + url, video_id, "mp4") + except AttributeError: + formats = extr._extract_m3u8_formats(url, video_id, "mp4") + subtitles = None + + elif manifest == "dash": + try: + formats, subtitles = extr._extract_mpd_formats_and_subtitles( + url, video_id) + except AttributeError: + formats = extr._extract_mpd_formats(url, video_id) + subtitles = None + + else: + self.log.error("Unsupported manifest type '%s'", manifest) + return None + + info_dict = { + "id" : video_id, + "title" : video_id, + "formats" : formats, + "subtitles": subtitles, + } + # extr._extra_manifest_info(info_dict, url) + return ytdl.process_ie_result(info_dict, download=False) + def _progress_hook(self, info): if info["status"] == "downloading" and \ info["elapsed"] >= self.progress: diff --git a/gallery_dl/extractor/behance.py b/gallery_dl/extractor/behance.py index 72f91954..14598b7a 100644 --- a/gallery_dl/extractor/behance.py +++ b/gallery_dl/extractor/behance.py @@ -171,6 +171,7 @@ class BehanceGalleryExtractor(BehanceExtractor): url = text.extr(page, '