1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-25 12:12:34 +01:00

[hentaicosplays] Add extractor (#1473)

This commit is contained in:
Hans Christian Gunawan 2021-04-19 03:28:00 +09:00 committed by GitHub
parent 82c32d25af
commit 334d690687
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 113 additions and 0 deletions

View File

@ -193,12 +193,24 @@ Consider all sites to be NSFW unless otherwise known.
<td>Chapters, Manga</td>
<td></td>
</tr>
<tr>
<td>Hentai Cosplay</td>
<td>https://hentai-cosplays.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, 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>
@ -541,6 +553,12 @@ Consider all sites to be NSFW unless otherwise known.
<td>Posts, Timelines</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>

View File

@ -40,6 +40,7 @@ modules = [
"gfycat",
"hbrowse",
"hentai2read",
"hentaicosplays",
"hentaifoundry",
"hentaifox",
"hentaihand",

View File

@ -0,0 +1,84 @@
# -*- 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.
"""
Extractor for https://hentai-cosplays.com/
(also works for hentai-img.com and porn-images-xxx.com)
"""
from .common import Extractor, Message
from .. import text
class HentaicosplaysGalleryExtractor(Extractor):
"""
Extractor for image galleries from hentai-cosplays.com, hentai-img.com,
and porn-images-xxx.com
"""
category = "hentaicosplays"
subcategory = "gallery"
directory_fmt = ("{site}", "{title}")
filename_fmt = "{filename}.{extension}"
archive_fmt = "{title}_{filename}"
root = "https://hentai-cosplays.com"
pattern = r"(?:https?://)?(?:\w{2}.)?" \
r"(hentai-cosplays|hentai-img|porn-images-xxx)\.com/" \
r"(?:image|story)/([\w-]+)(/\w+/\d+)?"
test = (
("https://hentai-cosplays.com/image/---devilism--tide-kurihara-/", {
"pattern": r"https://static\d?.hentai-cosplays.com/upload/"
r"\d+/\d+/\d+/\d+.jpg$",
"keyword": {
"count": 18,
"site": "hentai-cosplays",
"title": str,
},
}),
("https://fr.porn-images-xxx.com/image/enako-enako-24/", {
"pattern": r"https://static\d?.porn-images-xxx.com/upload/"
r"\d+/\d+/\d+/\d+.jpg$",
"keyword": {
"count": 11,
"site": "porn-images-xxx",
"title": str,
},
}),
("https://ja.hentai-img.com/image/hollow-cora-502/", {
"pattern": r"https://static\d?.hentai-img.com/upload/"
r"\d+/\d+/\d+/\d+.jpg$",
"keyword": {
"count": 2,
"site": "hentai-img",
"title": str,
},
}),
)
def __init__(self, match):
Extractor.__init__(self, match)
self.site = match.group(1)
self.title = match.group(2)
def items(self):
url = "https://{}.com/story/{}/".format(
self.site, self.title)
page = self.request(url).text
data = self.metadata(page)
images = text.extract_iter(page,
'<amp-img class="auto-style" src="', '"')
yield Message.Version, 1
yield Message.Directory, data
for image in images:
yield Message.Url, image, text.nameext_from_url(image, data)
def metadata(self, page):
"""Collect metadata for extractor-job"""
title = text.extract(page, "<title>", "</title>")[0]
title, _, _ = title.rpartition(" Story Viewer - ")
return {
"title": title,
"site": self.site,
}

View File

@ -38,10 +38,12 @@ CATEGORY_MAP = {
"hbrowse" : "HBrowse",
"hentai2read" : "Hentai2Read",
"hentaicafe" : "Hentai Cafe",
"hentaicosplays" : "Hentai Cosplay",
"hentaifoundry" : "Hentai Foundry",
"hentaifox" : "HentaiFox",
"hentaihand" : "HentaiHand",
"hentaihere" : "HentaiHere",
"hentaiimg" : "Hentai Image",
"hitomi" : "Hitomi.la",
"idolcomplex" : "Idol Complex",
"illusioncardsbooru": "Illusion Game Cards",
@ -76,6 +78,7 @@ CATEGORY_MAP = {
"nyafuu" : "Nyafuu Archive",
"paheal" : "rule #34",
"photovogue" : "PhotoVogue",
"pornimagesxxx" : "Porn Image",
"powermanga" : "PowerManga",
"readcomiconline": "Read Comic Online",
"rbt" : "RebeccaBlackTech",
@ -324,6 +327,13 @@ def build_extractor_list():
default["e-hentai"] = default["exhentai"]
domains["e-hentai"] = domains["exhentai"].replace("x", "-")
# 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/"
return categories, domains