# -*- coding: utf-8 -*- # Copyright 2020 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 # published by the Free Software Foundation. """Extractors for https://hentaihand.com/""" from .common import GalleryExtractor, Extractor, Message from .. import text, util import collections class HentaihandGalleryExtractor(GalleryExtractor): """Extractor for image galleries on hentaihand.com""" category = "hentaihand" root = "https://hentaihand.com" pattern = (r"(?i)(?:https?://)?(?:www\.)?hentaihand\.com" r"/(?:comi|view)c/(\d+)") test = ( ("https://hentaihand.com/comic/272772/kouda-tomohiro-chiyomi-bl", { "pattern": r"https://i.hentaihand.com/.*/images/full/\d+.jpg$", "count": 19, "keyword": { "artists" : ["kouda tomohiro"], "categories": ["manga"], "date" : "Feb. 6, 2020, 3:19 p.m.", "gallery_id": 272772, "lang" : "en", "language" : "English", "relationships": ["family", "step family"], "tags" : list, "title" : r"re:\[Kouda Tomohiro\] Chiyomi Blizzard", "title_jp" : r"re:\[幸田朋弘\] ちよみブリザード", }, }), ("https://hentaihand.com/viewc/272772/kouda-tomohiro-chiyomi-bl"), ) def __init__(self, match): self.gallery_id = match.group(1) url = "{}/comic/{}".format(self.root, self.gallery_id) GalleryExtractor.__init__(self, match, url) def metadata(self, page): extr = text.extract_from(page) title_en = text.unescape(extr("