diff --git a/docs/configuration.rst b/docs/configuration.rst index 2c6c6809..64d1a0af 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -1306,13 +1306,21 @@ Description extractor.deviantart.group -------------------------- Type - ``bool`` + * ``bool`` + * ``string`` Default ``true`` Description Check whether the profile name in a given URL belongs to a group or a regular user. + When disabled, assume every given profile name + belongs to a regular user. + + Special values: + + * ``"skip"``: Skip groups + extractor.deviantart.include ---------------------------- diff --git a/gallery_dl/extractor/deviantart.py b/gallery_dl/extractor/deviantart.py index 69953adb..78d8473a 100644 --- a/gallery_dl/extractor/deviantart.py +++ b/gallery_dl/extractor/deviantart.py @@ -91,14 +91,20 @@ class DeviantartExtractor(Extractor): return True def items(self): - if self.user and self.config("group", True): - profile = self.api.user_profile(self.user) - self.group = not profile - if self.group: - self.subcategory = "group-" + self.subcategory - self.user = self.user.lower() - else: - self.user = profile["user"]["username"] + if self.user: + group = self.config("group", True) + if group: + profile = self.api.user_profile(self.user) + if profile: + self.user = profile["user"]["username"] + self.group = False + elif group == "skip": + self.log.info("Skipping group '%s'", self.user) + raise exception.StopExtraction() + else: + self.subcategory = "group-" + self.subcategory + self.user = self.user.lower() + self.group = True for deviation in self.deviations(): if isinstance(deviation, tuple): diff --git a/test/results/deviantart.py b/test/results/deviantart.py index 82513ee3..e7ca59bb 100644 --- a/test/results/deviantart.py +++ b/test/results/deviantart.py @@ -123,6 +123,16 @@ __tests__ = ( "#count" : ">= 15", }, +{ + "#url" : "https://www.deviantart.com/yakuzafc/gallery", + "#comment" : "'group': 'skip' (#4630)", + "#category" : ("", "deviantart", "gallery"), + "#class" : deviantart.DeviantartGalleryExtractor, + "#options" : {"group": "skip"}, + "#exception": exception.StopExtraction, + "#count" : 0, +}, + { "#url" : "https://www.deviantart.com/justatest235723/gallery", "#comment" : "'folders' option (#276)", @@ -725,7 +735,7 @@ __tests__ = ( { "#url" : "https://www.deviantart.com/chain-man/gallery/scraps", - "#comment" : "deactivated account" + "#comment" : "deactivated account", "#category": ("", "deviantart", "scraps"), "#class" : deviantart.DeviantartScrapsExtractor, },