mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-22 02:32:33 +01:00
[deviantart] implement '"group": "skip"' (#4630)
This commit is contained in:
parent
a9c3442d4e
commit
2d41702762
@ -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
|
||||
----------------------------
|
||||
|
@ -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):
|
||||
|
@ -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,
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user