diff --git a/gallery_dl/extractor/nsfwalbum.py b/gallery_dl/extractor/nsfwalbum.py index 8f1f3f22..9c4d6860 100644 --- a/gallery_dl/extractor/nsfwalbum.py +++ b/gallery_dl/extractor/nsfwalbum.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright 2019 Mike Fährmann +# Copyright 2019-2021 Mike Fährmann # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as @@ -44,16 +44,23 @@ class NsfwalbumAlbumExtractor(GalleryExtractor): iframe = self.root + "/iframe_image.php?id=" backend = self.root + "/backend.php" for image_id in text.extract_iter(page, 'data-img-id="', '"'): - spirit = text.extract(self.request( - iframe + image_id).text, 'giraffe.annihilate("', '"')[0] - params = {"spirit": self._annihilate(spirit), "photo": image_id} + spirit = self._annihilate(text.extract(self.request( + iframe + image_id).text, 'giraffe.annihilate("', '"')[0]) + params = {"spirit": spirit, "photo": image_id} data = self.request(backend, params=params).json() yield data[0], { "id" : text.parse_int(image_id), "width" : text.parse_int(data[1]), "height": text.parse_int(data[2]), + "_http_validate": self._validate_response, + "_fallback": ("{}/imageProxy.php?photoId={}&spirit={}".format( + self.root, image_id, spirit),), } + @staticmethod + def _validate_response(response): + return not response.request.url.endswith("/no_image.jpg") + @staticmethod def _annihilate(value, base=6): return "".join(