diff --git a/docs/supportedsites.md b/docs/supportedsites.md index f779217e..7dc3f893 100644 --- a/docs/supportedsites.md +++ b/docs/supportedsites.md @@ -325,24 +325,12 @@ Consider all listed sites to potentially be NSFW. Archive, Individual Posts, Home Feed, Search Results - - Hentai Cosplay - https://hentai-cosplay-xxx.com/ - Galleries - - Hentai Foundry https://www.hentai-foundry.com/ Favorites, individual Images, Pictures, Popular Images, Recent Images, Scraps, Stories, Tag Searches, User Profiles - - Hentai Image - https://hentai-img.com/ - Galleries - - Hentai2Read https://hentai2read.com/ @@ -751,12 +739,6 @@ Consider all listed sites to potentially be NSFW. Posts Images, Search Results, User Profiles - - Porn Image - https://porn-images-xxx.com/ - Galleries - - Pornhub https://www.pornhub.com/ @@ -1268,6 +1250,28 @@ Consider all listed sites to potentially be NSFW. + + Hentai Cosplay Instances + + + Hentai Cosplay + https://hentai-cosplay-xxx.com/ + Galleries + + + + Hentai Image + https://hentai-img-xxx.com/ + Galleries + + + + Porn Image + https://porn-image.com/ + Galleries + + + jschan Imageboards diff --git a/gallery_dl/extractor/hentaicosplays.py b/gallery_dl/extractor/hentaicosplays.py index fbbae16d..4992b7b8 100644 --- a/gallery_dl/extractor/hentaicosplays.py +++ b/gallery_dl/extractor/hentaicosplays.py @@ -5,31 +5,46 @@ # published by the Free Software Foundation. """Extractors for https://hentai-cosplay-xxx.com/ -(also works for hentai-img.com and porn-images-xxx.com)""" +(also works for hentai-img-xxx.com and porn-image.com)""" -from .common import GalleryExtractor +from .common import BaseExtractor, GalleryExtractor from .. import text -class HentaicosplaysGalleryExtractor(GalleryExtractor): +class HentaicosplaysExtractor(BaseExtractor): + basecategory = "hentaicosplays" + + +BASE_PATTERN = HentaicosplaysExtractor.update({ + "hentaicosplay": { + "root": "https://hentai-cosplay-xxx.com", + "pattern": r"(?:\w\w\.)?hentai-cosplays?(?:-xxx)?\.com", + }, + "hentaiimg": { + "root": "https://hentai-img-xxx.com", + "pattern": r"(?:\w\w\.)?hentai-img(?:-xxx)?\.com", + }, + "pornimage": { + "root": "https://porn-image.com", + "pattern": r"(?:\w\w\.)?porn-images?(?:-xxx)?\.com", + }, +}) + + +class HentaicosplaysGalleryExtractor( + HentaicosplaysExtractor, GalleryExtractor): """Extractor for image galleries from - hentai-cosplay-xxx.com, hentai-img.com, and porn-images-xxx.com""" - category = "hentaicosplays" + hentai-cosplay-xxx.com, hentai-img-xxx.com, and porn-image.com""" directory_fmt = ("{site}", "{title}") filename_fmt = "{filename}.{extension}" archive_fmt = "{title}_{filename}" - pattern = r"((?:https?://)?(?:\w{2}\.)?" \ - r"(hentai-cosplay(?:s|-xxx)|hentai-img|porn-images-xxx)\.com)/" \ - r"(?:image|story)/([\w-]+)" + pattern = BASE_PATTERN + r"/(?:image|story)/([\w-]+)" example = "https://hentai-cosplay-xxx.com/image/TITLE/" def __init__(self, match): - root, self.site, self.slug = match.groups() - self.root = text.ensure_http_scheme(root) - if self.root == "https://hentai-cosplays.com": - self.root = "https://hentai-cosplay-xxx.com" - url = "{}/story/{}/".format(self.root, self.slug) - GalleryExtractor.__init__(self, match, url) + BaseExtractor.__init__(self, match) + self.slug = self.groups[-1] + self.gallery_url = "{}/story/{}/".format(self.root, self.slug) def _init(self): self.session.headers["Referer"] = self.gallery_url @@ -39,7 +54,7 @@ class HentaicosplaysGalleryExtractor(GalleryExtractor): return { "title": text.unescape(title.rpartition(" Story Viewer - ")[0]), "slug" : self.slug, - "site" : self.site, + "site" : self.root.partition("://")[2].rpartition(".")[0], } def images(self, page): diff --git a/scripts/supportedsites.py b/scripts/supportedsites.py index aafdb0d2..bfb2e2a4 100755 --- a/scripts/supportedsites.py +++ b/scripts/supportedsites.py @@ -59,7 +59,7 @@ CATEGORY_MAP = { "hatenablog" : "HatenaBlog", "hbrowse" : "HBrowse", "hentai2read" : "Hentai2Read", - "hentaicosplays" : "Hentai Cosplay", + "hentaicosplay" : "Hentai Cosplay", "hentaifoundry" : "Hentai Foundry", "hentaifox" : "HentaiFox", "hentaihand" : "HentaiHand", @@ -112,7 +112,7 @@ CATEGORY_MAP = { "photovogue" : "PhotoVogue", "pidgiwiki" : "PidgiWiki", "pixeldrain" : "pixeldrain", - "pornimagesxxx" : "Porn Image", + "pornimage" : "Porn Image", "pornpics" : "PornPics.com", "pornreactor" : "PornReactor", "readcomiconline": "Read Comic Online", @@ -366,6 +366,7 @@ BASE_MAP = { "foolslide" : "FoOlSlide Instances", "gelbooru_v01": "Gelbooru Beta 0.1.11", "gelbooru_v02": "Gelbooru Beta 0.2", + "hentaicosplays": "Hentai Cosplay Instances", "jschan" : "jschan Imageboards", "lolisafe" : "lolisafe and chibisafe", "lynxchan" : "LynxChan Imageboards", @@ -561,13 +562,6 @@ def build_extractor_list(): default["coomerparty"] = default["kemonoparty"] domains["coomerparty"] = domains["kemonoparty"].replace("kemono", "coomer") - # add hentai-cosplays sister sites (hentai-img, porn-images-xxx) - default["hentaiimg"] = default["hentaicosplays"] - domains["hentaiimg"] = "https://hentai-img.com/" - - default["pornimagesxxx"] = default["hentaicosplays"] - domains["pornimagesxxx"] = "https://porn-images-xxx.com/" - # add manga4life.com default["mangalife"] = default["mangasee"] domains["mangalife"] = "https://manga4life.com/" diff --git a/test/results/hentaicosplays.py b/test/results/hentaicosplays.py index 5964b445..e1cfbb27 100644 --- a/test/results/hentaicosplays.py +++ b/test/results/hentaicosplays.py @@ -10,7 +10,7 @@ from gallery_dl.extractor import hentaicosplays __tests__ = ( { "#url" : "https://hentai-cosplay-xxx.com/image/---devilism--tide-kurihara-/", - "#category": ("", "hentaicosplays", "gallery"), + "#category": ("hentaicosplays", "hentaicosplay", "gallery"), "#class" : hentaicosplays.HentaicosplaysGalleryExtractor, "#pattern" : r"https://static\d?\.hentai-cosplay-xxx\.com/upload/\d+/\d+/\d+/\d+\.jpg$", @@ -22,36 +22,48 @@ __tests__ = ( { "#url" : "https://hentai-cosplays.com/image/---devilism--tide-kurihara-/", - "#category": ("", "hentaicosplays", "gallery"), + "#category": ("hentaicosplays", "hentaicosplay", "gallery"), "#class" : hentaicosplays.HentaicosplaysGalleryExtractor, "#pattern" : r"https://static\d?\.hentai-cosplay-xxx\.com/upload/\d+/\d+/\d+/\d+\.jpg$", "count": 18, - "site" : "hentai-cosplays", + "site" : "hentai-cosplay-xxx", "slug" : "---devilism--tide-kurihara-", "title": "艦 こ れ-devilism の tide Kurihara 憂", }, { - "#url" : "https://fr.porn-images-xxx.com/image/enako-enako-24/", - "#category": ("", "hentaicosplays", "gallery"), + "#url" : "https://fr.porn-image.com/image/enako-enako-24/", + "#category": ("hentaicosplays", "pornimage", "gallery"), "#class" : hentaicosplays.HentaicosplaysGalleryExtractor, - "#pattern" : r"https://static\d?.porn-images-xxx.com/upload/\d+/\d+/\d+/\d+.jpg$", + "#pattern" : r"https://static\d?.porn-image.com/upload/\d+/\d+/\d+/\d+.jpg$", "count": 11, - "site" : "porn-images-xxx", + "site" : "porn-image", + "title": str, +}, + +{ + "#url" : "https://fr.porn-images-xxx.com/image/enako-enako-24/", + "#category": ("hentaicosplays", "pornimage", "gallery"), + "#class" : hentaicosplays.HentaicosplaysGalleryExtractor, +}, + +{ + "#url" : "https://ja.hentai-img-xxx.com/image/hollow-cora-502/", + "#category": ("hentaicosplays", "hentaiimg", "gallery"), + "#class" : hentaicosplays.HentaicosplaysGalleryExtractor, + "#pattern" : r"https://static\d?.hentai-img-xxx.com/upload/\d+/\d+/\d+/\d+.jpg$", + + "count": 2, + "site" : "hentai-img-xxx", "title": str, }, { "#url" : "https://ja.hentai-img.com/image/hollow-cora-502/", - "#category": ("", "hentaicosplays", "gallery"), + "#category": ("hentaicosplays", "hentaiimg", "gallery"), "#class" : hentaicosplays.HentaicosplaysGalleryExtractor, - "#pattern" : r"https://static\d?.hentai-img.com/upload/\d+/\d+/\d+/\d+.jpg$", - - "count": 2, - "site" : "hentai-img", - "title": str, }, )