From baf3815ebd55f5cbe44f0952075f5a12a64b2c6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Thu, 14 Jul 2022 14:59:11 +0200 Subject: [PATCH] [nozomi] small code optimizations --- gallery_dl/extractor/nozomi.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gallery_dl/extractor/nozomi.py b/gallery_dl/extractor/nozomi.py index d4348340..713330dd 100644 --- a/gallery_dl/extractor/nozomi.py +++ b/gallery_dl/extractor/nozomi.py @@ -194,12 +194,13 @@ class NozomiSearchExtractor(NozomiExtractor): def posts(self): result = None + positive = [] + negative = [] def nozomi(path): url = "https://j.nozomi.la/" + path + ".nozomi" return decode_nozomi(self.request(url).content) - positive, negative = [], [] for tag in self.tags: (negative if tag[0] == "-" else positive).append( tag.replace("/", "")) @@ -211,9 +212,9 @@ class NozomiSearchExtractor(NozomiExtractor): else: result.intersection_update(ids) + if result is None: + result = set(nozomi("index")) for tag in negative: - if result is None: - result = set(nozomi("index")) result.difference_update(nozomi("nozomi/" + tag[1:])) return sorted(result, reverse=True) if result else ()