diff options
| author | 2025-07-31 01:22:01 -0400 | |
|---|---|---|
| committer | 2025-07-31 01:22:01 -0400 | |
| commit | a6e995c093de8aae2e91a0787281bb34c0b871eb (patch) | |
| tree | 2d79821b05300d34d8871eb6c9662b359a2de85d /gallery_dl/extractor/ytdl.py | |
| parent | 7672a750cb74bf31e21d76aad2776367fd476155 (diff) | |
New upstream version 1.30.2.upstream/1.30.2
Diffstat (limited to 'gallery_dl/extractor/ytdl.py')
| -rw-r--r-- | gallery_dl/extractor/ytdl.py | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/gallery_dl/extractor/ytdl.py b/gallery_dl/extractor/ytdl.py index 168845e..eb33b65 100644 --- a/gallery_dl/extractor/ytdl.py +++ b/gallery_dl/extractor/ytdl.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright 2021-2023 Mike Fährmann +# Copyright 2021-2025 Mike Fährmann # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as @@ -28,7 +28,7 @@ class YoutubeDLExtractor(Extractor): self.ytdl_module_name = ytdl_module.__name__ # find suitable youtube_dl extractor - self.ytdl_url = url = match.group(1) + self.ytdl_url = url = match[1] generic = config.interpolate(("extractor", "ytdl"), "generic", True) if generic == "force": self.ytdl_ie_key = "Generic" @@ -42,8 +42,14 @@ class YoutubeDLExtractor(Extractor): raise exception.NoExtractorError() self.force_generic_extractor = False - # set subcategory to youtube_dl extractor's key - self.subcategory = self.ytdl_ie_key + if self.ytdl_ie_key == "Generic" and config.interpolate( + ("extractor", "ytdl"), "generic-category", True): + # set subcategory to URL domain + self.category = "ytdl-generic" + self.subcategory = url[url.rfind("/", None, 8)+1:url.find("/", 8)] + else: + # set subcategory to youtube_dl extractor's key + self.subcategory = self.ytdl_ie_key Extractor.__init__(self, match) def items(self): @@ -76,8 +82,7 @@ class YoutubeDLExtractor(Extractor): ytdl_module, self, user_opts, extr_opts) # transfer cookies to ytdl - cookies = self.cookies - if cookies: + if cookies := self.cookies: set_cookie = ytdl_instance.cookiejar.set_cookie for cookie in cookies: set_cookie(cookie) @@ -89,7 +94,7 @@ class YoutubeDLExtractor(Extractor): ytdl_instance.get_info_extractor(self.ytdl_ie_key), False, {}, True) except ytdl_module.utils.YoutubeDLError: - raise exception.StopExtraction("Failed to extract video data") + raise exception.AbortExtraction("Failed to extract video data") if not info_dict: return |
