diff --git a/gallery_dl/extractor/imagefap.py b/gallery_dl/extractor/imagefap.py index 770c49ce..a1d88635 100644 --- a/gallery_dl/extractor/imagefap.py +++ b/gallery_dl/extractor/imagefap.py @@ -30,12 +30,12 @@ class ImagefapGalleryExtractor(ImagefapExtractor): test = [ ("https://www.imagefap.com/pictures/7102714", { "url": "268995eac5d01ddecd0fe58cfa9828390dc85a84", - "keyword": "b65c310d75269cb6dcc32c3fc1bdcf39bea45342", + "keyword": "3b90205f434bd1e0461bdbd5d2d9c34056b50fe6", "content": "694a0a57385980a6f90fbc296cadcd6c11ba2dab", }), ("https://www.imagefap.com/gallery/5486966", { "url": "14906b4f0b8053d1d69bc730a325acb793cbc898", - "keyword": "b84da0543c2d1f848bf5e4c2950dd4f4543a1e0c", + "keyword": "66ccb98b69cb52f89540224260641002f41f6ece", }), ("https://www.imagefap.com/gallery.php?gid=7102714", None), ] @@ -57,15 +57,20 @@ class ImagefapGalleryExtractor(ImagefapExtractor): def get_job_metadata(self, page): """Collect metadata for extractor-job""" - data, pos = text.extract_all(page, ( - ("section" , 'Porn pics of ', ' (Page 1)'), - ("uploader", '>Uploaded by ', ''), - ("count" , ' 1 of ', ' pics"'), - ), values={"gallery_id": self.gid}) + descr, pos = text.extract( + page, '', '', pos) - json_dict = json.loads(json_data) - json_dict["section"] = section - return json_dict + info = json.loads(text.extract( + page, '')[0]) + parts = info["contentUrl"].rsplit("/", 3) + return text.nameext_from_url(parts[3], { + "url": info["contentUrl"], + "title": text.unescape(info["name"]), + "uploader": info["author"], + "date": info["datePublished"], + "width": text.parse_int(info["width"]), + "height": text.parse_int(info["height"]), + "gallery_id": text.parse_int(parts[1]), + "image_id": text.parse_int(parts[2]), + }) class ImagefapUserExtractor(ImagefapExtractor):