2020-09-17 17:32:54 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
# 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
|
|
|
|
# published by the Free Software Foundation.
|
|
|
|
|
2022-07-12 15:46:51 +02:00
|
|
|
"""Extractors for https://myhentaigallery.com/"""
|
2020-09-17 17:32:54 +02:00
|
|
|
|
|
|
|
from .common import GalleryExtractor
|
|
|
|
from .. import text, exception
|
|
|
|
|
|
|
|
|
|
|
|
class MyhentaigalleryGalleryExtractor(GalleryExtractor):
|
|
|
|
"""Extractor for image galleries from myhentaigallery.com"""
|
|
|
|
category = "myhentaigallery"
|
2020-09-17 18:06:12 +02:00
|
|
|
directory_fmt = ("{category}", "{gallery_id} {artist:?[/] /J, }{title}")
|
|
|
|
pattern = (r"(?:https?://)?myhentaigallery\.com"
|
|
|
|
r"/gallery/(?:thumbnails|show)/(\d+)")
|
2020-09-17 17:32:54 +02:00
|
|
|
test = (
|
2020-09-17 18:06:12 +02:00
|
|
|
("https://myhentaigallery.com/gallery/thumbnails/16247", {
|
2022-07-12 15:46:51 +02:00
|
|
|
"pattern": r"https://images.myhentaicomics\.com/imagesgallery"
|
|
|
|
r"/images/[^/]+/original/\d+\.jpg",
|
2020-09-17 18:06:12 +02:00
|
|
|
"keyword": {
|
|
|
|
"artist" : list,
|
|
|
|
"count" : 11,
|
|
|
|
"gallery_id": 16247,
|
|
|
|
"group" : list,
|
|
|
|
"parodies" : list,
|
|
|
|
"tags" : ["Giantess"],
|
|
|
|
"title" : "Attack Of The 50ft Woman 1",
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
("https://myhentaigallery.com/gallery/show/16247/1"),
|
2020-09-17 17:32:54 +02:00
|
|
|
)
|
2020-09-17 18:06:12 +02:00
|
|
|
root = "https://myhentaigallery.com"
|
2020-09-17 17:32:54 +02:00
|
|
|
|
|
|
|
def __init__(self, match):
|
2020-09-17 18:06:12 +02:00
|
|
|
self.gallery_id = match.group(1)
|
|
|
|
url = "{}/gallery/thumbnails/{}".format(self.root, self.gallery_id)
|
2020-09-17 17:32:54 +02:00
|
|
|
GalleryExtractor.__init__(self, match, url)
|
|
|
|
self.session.headers["Referer"] = url
|
|
|
|
|
|
|
|
def metadata(self, page):
|
|
|
|
extr = text.extract_from(page)
|
|
|
|
split = text.split_html
|
|
|
|
|
2023-01-06 16:33:04 +01:00
|
|
|
title = extr('<div class="comic-description">\n', '</h1>').lstrip()
|
|
|
|
if title.startswith("<h1>"):
|
|
|
|
title = title[len("<h1>"):]
|
|
|
|
|
2020-09-17 17:32:54 +02:00
|
|
|
if not title:
|
|
|
|
raise exception.NotFoundError("gallery")
|
2020-09-17 18:06:12 +02:00
|
|
|
|
|
|
|
return {
|
2020-09-17 17:32:54 +02:00
|
|
|
"title" : text.unescape(title),
|
2020-09-17 18:06:12 +02:00
|
|
|
"gallery_id": text.parse_int(self.gallery_id),
|
2020-09-17 17:32:54 +02:00
|
|
|
"tags" : split(extr('<div>\nCategories:', '</div>')),
|
2020-09-17 18:06:12 +02:00
|
|
|
"artist" : split(extr('<div>\nArtists:' , '</div>')),
|
|
|
|
"group" : split(extr('<div>\nGroups:' , '</div>')),
|
|
|
|
"parodies" : split(extr('<div>\nParodies:' , '</div>')),
|
2020-09-17 17:32:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
def images(self, page):
|
|
|
|
return [
|
2022-11-04 23:39:38 +01:00
|
|
|
(text.unescape(text.extr(url, 'src="', '"')).replace(
|
2020-09-17 18:06:12 +02:00
|
|
|
"/thumbnail/", "/original/"), None)
|
|
|
|
for url in text.extract_iter(page, 'class="comic-thumb"', '</div>')
|
2020-09-17 17:32:54 +02:00
|
|
|
]
|