aboutsummaryrefslogtreecommitdiffstats
path: root/gallery_dl/extractor/hentaicosplays.py
diff options
context:
space:
mode:
Diffstat (limited to 'gallery_dl/extractor/hentaicosplays.py')
-rw-r--r--gallery_dl/extractor/hentaicosplays.py45
1 files changed, 30 insertions, 15 deletions
diff --git a/gallery_dl/extractor/hentaicosplays.py b/gallery_dl/extractor/hentaicosplays.py
index fbbae16..4992b7b 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):