diff --git a/docs/configuration.rst b/docs/configuration.rst index dd9b33e8..197c698e 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -5707,12 +5707,24 @@ Type Default ``true`` Description - Enables the use of |ytdl's| ``generic`` extractor. + Enables the use of |ytdl's| ``Generic`` extractor. Set this option to ``"force"`` for the same effect as ``--force-generic-extractor``. +extractor.ytdl.generic-category +------------------------------- +Type + ``bool`` +Default + ``true`` +Description + When using |ytdl's| ``Generic`` extractor, + change `category` to ``"ytdl-generic"`` and + set `subcategory` to the input URL's domain. + + extractor.ytdl.logging ---------------------- Type diff --git a/docs/gallery-dl.conf b/docs/gallery-dl.conf index 74980823..f7773cd2 100644 --- a/docs/gallery-dl.conf +++ b/docs/gallery-dl.conf @@ -808,6 +808,7 @@ "enabled" : false, "format" : null, "generic" : true, + "generic-category": true, "logging" : true, "module" : null, "raw-options" : null diff --git a/gallery_dl/extractor/ytdl.py b/gallery_dl/extractor/ytdl.py index 168845ea..d5c51f84 100644 --- a/gallery_dl/extractor/ytdl.py +++ b/gallery_dl/extractor/ytdl.py @@ -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): diff --git a/test/results/ytdl.py b/test/results/ytdl.py index 1aecee91..a4ef0971 100644 --- a/test/results/ytdl.py +++ b/test/results/ytdl.py @@ -14,4 +14,10 @@ __tests__ = ( "#class" : ytdl.YoutubeDLExtractor, }, +{ + "#url" : "ytdl:http://media.w3.org/2010/05/sintel/trailer.mp4", + "#category": ("", "ytdl-generic", "media.w3.org"), + "#class" : ytdl.YoutubeDLExtractor, +}, + )