1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-22 18:53:21 +01:00

[nozomi] small code optimizations

This commit is contained in:
Mike Fährmann 2022-07-14 14:59:11 +02:00
parent 9704c04172
commit baf3815ebd
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

View File

@ -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 ()