diff --git a/docs/configuration.rst b/docs/configuration.rst index c986e07c..117e143c 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -1388,6 +1388,18 @@ Description Extract ``comments`` metadata. +extractor.deviantart.comments-avatars +------------------------------------- +Type + ``bool`` +Default + ``false`` +Description + Download the avatar of each commenting user. + + Note: Enabling this option also enables deviantart.comments_. + + extractor.deviantart.extra -------------------------- Type @@ -6009,6 +6021,7 @@ Description .. _base-directory: `extractor.*.base-directory`_ .. _date-format: `extractor.*.date-format`_ .. _deviantart.metadata: `extractor.deviantart.metadata`_ +.. _deviantart.comments: `extractor.deviantart.comments`_ .. _postprocessors: `extractor.*.postprocessors`_ .. _download archive: `extractor.*.archive`_ diff --git a/gallery_dl/extractor/deviantart.py b/gallery_dl/extractor/deviantart.py index c0c0f9a3..7235c479 100644 --- a/gallery_dl/extractor/deviantart.py +++ b/gallery_dl/extractor/deviantart.py @@ -47,8 +47,9 @@ class DeviantartExtractor(Extractor): self.extra = self.config("extra", False) self.quality = self.config("quality", "100") self.original = self.config("original", True) - self.comments = self.config("comments", False) self.intermediary = self.config("intermediary", True) + self.comments_avatars = self.config("comments-avatars", False) + self.comments = self.comments_avatars or self.config("comments", False) self.api = DeviantartOAuthAPI(self) self.group = False @@ -172,6 +173,13 @@ class DeviantartExtractor(Extractor): deviation["is_original"] = True yield self.commit_journal(deviation, journal) + if self.comments_avatars: + for comment in deviation["comments"]: + url = "{}/{}/avatar/".format( + self.root, comment["user"]["username"]) + comment["_extractor"] = DeviantartAvatarExtractor + yield Message.Queue, url, comment + if not self.extra: continue diff --git a/test/results/deviantart.py b/test/results/deviantart.py index 5fd17761..599ca9ff 100644 --- a/test/results/deviantart.py +++ b/test/results/deviantart.py @@ -703,6 +703,20 @@ __tests__ = ( "comments": "len:20", }, +{ + "#url" : "https://www.deviantart.com/justatest235723/art/Blue-811519058", + "#comment" : "comment avatars (#4995)", + "#category": ("", "deviantart", "deviation"), + "#class" : deviantart.DeviantartDeviationExtractor, + "#options" : { + "original" : False, + "comments-avatars": True, + }, + "#range" : "5-", + "#pattern" : r"^https://www\.deviantart\.com/justatest235723/avatar/$", + "#count" : 16, +}, + { "#url" : "https://www.deviantart.com/citizenfresh/art/Hverarond-789295466", "#comment" : "wixmp URL rewrite /intermediary/",