diff options
| author | 2021-02-16 21:35:52 -0500 | |
|---|---|---|
| committer | 2021-02-16 21:35:52 -0500 | |
| commit | fc83315c164afd74734adf27e0f7fec2011904aa (patch) | |
| tree | d5976be93924dc4cd76c41e5e3f13bb44b6516b3 /gallery_dl/extractor/nsfwalbum.py | |
| parent | 2e29d2158d56879e5578dfabf9e8c0fa2e855ccf (diff) | |
New upstream version 1.16.5.upstream/1.16.5
Diffstat (limited to 'gallery_dl/extractor/nsfwalbum.py')
| -rw-r--r-- | gallery_dl/extractor/nsfwalbum.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/gallery_dl/extractor/nsfwalbum.py b/gallery_dl/extractor/nsfwalbum.py index 8f1f3f2..9c4d686 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,17 +44,24 @@ 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( chr(ord(char) ^ base) |
