From ae98dbcbb33cdd155132f046bbe09971d5273194 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Thu, 17 Oct 2019 22:37:09 +0200 Subject: [PATCH] [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. --- gallery_dl/extractor/nozomi.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/gallery_dl/extractor/nozomi.py b/gallery_dl/extractor/nozomi.py index dcb5863f..ed786239 100644 --- a/gallery_dl/extractor/nozomi.py +++ b/gallery_dl/extractor/nozomi.py @@ -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)