From fbc0a6a0598f8cc88c233b4782f6d57aded3af5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Thu, 17 Oct 2019 23:05:04 +0200 Subject: [PATCH] [nozomi] skip unavailable posts (#388) --- gallery_dl/extractor/nozomi.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gallery_dl/extractor/nozomi.py b/gallery_dl/extractor/nozomi.py index ed786239..97be7896 100644 --- a/gallery_dl/extractor/nozomi.py +++ b/gallery_dl/extractor/nozomi.py @@ -29,8 +29,15 @@ class NozomiExtractor(Extractor): for post_id in map(str, self.posts()): url = "https://j.nozomi.la/post/{}/{}/{}.json".format( post_id[-1], post_id[-3:-1], post_id) - image = self.request(url).json() + response = self.request(url, fatal=False) + if response.status_code >= 400: + self.log.warning( + "Skipping post %s ('%s %s')", + post_id, response.status_code, response.reason) + continue + + image = response.json() image["tags"] = self._list(image.get("general")) image["artist"] = self._list(image.get("artist")) image["copyright"] = self._list(image.get("copyright"))