1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2025-02-01 03:51:42 +01:00

[hentaicosplays] update domains (#6578)

inherit from BaseExtractor to make differentiating between sites easier
This commit is contained in:
Mike Fährmann 2024-12-03 13:16:33 +01:00
parent d9bbe3b3b3
commit d96717e2e6
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
4 changed files with 80 additions and 55 deletions

View File

@ -325,24 +325,12 @@ Consider all listed sites to potentially be NSFW.
<td>Archive, Individual Posts, Home Feed, Search Results</td>
<td></td>
</tr>
<tr>
<td>Hentai Cosplay</td>
<td>https://hentai-cosplay-xxx.com/</td>
<td>Galleries</td>
<td></td>
</tr>
<tr>
<td>Hentai Foundry</td>
<td>https://www.hentai-foundry.com/</td>
<td>Favorites, individual Images, Pictures, Popular Images, Recent Images, Scraps, Stories, Tag Searches, User Profiles</td>
<td></td>
</tr>
<tr>
<td>Hentai Image</td>
<td>https://hentai-img.com/</td>
<td>Galleries</td>
<td></td>
</tr>
<tr>
<td>Hentai2Read</td>
<td>https://hentai2read.com/</td>
@ -751,12 +739,6 @@ Consider all listed sites to potentially be NSFW.
<td>Posts Images, Search Results, User Profiles</td>
<td></td>
</tr>
<tr>
<td>Porn Image</td>
<td>https://porn-images-xxx.com/</td>
<td>Galleries</td>
<td></td>
</tr>
<tr>
<td>Pornhub</td>
<td>https://www.pornhub.com/</td>
@ -1268,6 +1250,28 @@ Consider all listed sites to potentially be NSFW.
<td></td>
</tr>
<tr>
<td colspan="4"><strong>Hentai Cosplay Instances</strong></td>
</tr>
<tr>
<td>Hentai Cosplay</td>
<td>https://hentai-cosplay-xxx.com/</td>
<td>Galleries</td>
<td></td>
</tr>
<tr>
<td>Hentai Image</td>
<td>https://hentai-img-xxx.com/</td>
<td>Galleries</td>
<td></td>
</tr>
<tr>
<td>Porn Image</td>
<td>https://porn-image.com/</td>
<td>Galleries</td>
<td></td>
</tr>
<tr>
<td colspan="4"><strong>jschan Imageboards</strong></td>
</tr>

View File

@ -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):

View File

@ -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/"

View File

@ -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,
},
)