Skip to content

Commit

Permalink
[nozomi] small code optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Jul 14, 2022
1 parent 9704c04 commit baf3815
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions gallery_dl/extractor/nozomi.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,13 @@ def metadata(self):

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("/", ""))
Expand All @@ -211,9 +212,9 @@ def nozomi(path):
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 ()

0 comments on commit baf3815

Please sign in to comment.