[nozomi] implement searching for negated terms (#388)

It's incredibly slow and resource intensive (> 1GB of memory),
but that is also how it is implemented on nozomi.la itself.
pull/465/head
Mike Fährmann 5 years ago
parent 1c03a389df
commit ae98dbcbb3
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -155,11 +155,20 @@ class NozomiSearchExtractor(NozomiExtractor):
return {"search_tags": self.tags}
def posts(self):
index = None
result = set()
def nozomi(path):
url = "https://j.nozomi.la/" + path + ".nozomi"
return self._unpack(self.request(url).content)
for tag in self.tags:
url = "https://j.nozomi.la/nozomi/{}.nozomi".format(tag)
items = self._unpack(self.request(url).content)
if tag[0] == "-":
if not index:
index = set(nozomi("index"))
items = index.difference(nozomi("nozomi/" + tag[1:]))
else:
items = nozomi("nozomi/" + tag)
if result:
result.intersection_update(items)

Loading…
Cancel
Save