diff --git a/gallery_dl/extractor/deviantart.py b/gallery_dl/extractor/deviantart.py index dfa45ef8..903cc4b7 100644 --- a/gallery_dl/extractor/deviantart.py +++ b/gallery_dl/extractor/deviantart.py @@ -29,21 +29,19 @@ class DeviantartExtractor(Extractor): self.offset = 0 self.flat = self.config("flat", True) self.original = self.config("original", True) - - if match: - self.user = match.group(1) - self.group = not self.api.user_profile(self.user) - if self.group: - self.subcategory = "group-" + self.subcategory - else: - self.user = None - self.group = False + self.user = match.group(1) if match else None + self.group = False def skip(self, num): self.offset += num return num def items(self): + if self.user: + self.group = not self.api.user_profile(self.user) + if self.group: + self.subcategory = "group-" + self.subcategory + yield Message.Version, 1 for deviation in self.deviations(): if isinstance(deviation, tuple): diff --git a/gallery_dl/job.py b/gallery_dl/job.py index 8352bb23..8e592609 100644 --- a/gallery_dl/job.py +++ b/gallery_dl/job.py @@ -137,8 +137,8 @@ class DownloadJob(Job): def __init__(self, url, parent=None): Job.__init__(self, url, parent) - self.pathfmt = util.PathFormat(self.extractor) - self.sleep = self.extractor.config("sleep") + self.pathfmt = None + self.sleep = None self.downloaders = {} self.out = output.select() @@ -155,6 +155,9 @@ class DownloadJob(Job): def handle_directory(self, keywords): """Set and create the target directory for downloads""" + if not self.pathfmt: + self.pathfmt = util.PathFormat(self.extractor) + self.sleep = self.extractor.config("sleep") self.pathfmt.set_directory(keywords) def handle_queue(self, url, keywords):