summaryrefslogtreecommitdiffstats
path: root/gallery_dl/extractor/nsfwalbum.py
diff options
context:
space:
mode:
Diffstat (limited to 'gallery_dl/extractor/nsfwalbum.py')
-rw-r--r--gallery_dl/extractor/nsfwalbum.py15
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)