From 8d1805e336810a2380fbb15bdb5b3641d8a74cfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Sat, 10 Aug 2024 12:14:18 +0200 Subject: [PATCH] [hentaicosplays] support 'hentai-cosplay-xxx.com' (#5959) --- docs/supportedsites.md | 2 +- gallery_dl/extractor/hentaicosplays.py | 10 ++++++---- test/results/hentaicosplays.py | 14 +++++++++++++- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/docs/supportedsites.md b/docs/supportedsites.md index 1e945926bd..660558ca4a 100644 --- a/docs/supportedsites.md +++ b/docs/supportedsites.md @@ -285,7 +285,7 @@ Consider all listed sites to potentially be NSFW. Hentai Cosplay - https://hentai-cosplays.com/ + https://hentai-cosplay-xxx.com/ Galleries diff --git a/gallery_dl/extractor/hentaicosplays.py b/gallery_dl/extractor/hentaicosplays.py index d5ff8c831a..fbbae16df6 100644 --- a/gallery_dl/extractor/hentaicosplays.py +++ b/gallery_dl/extractor/hentaicosplays.py @@ -4,7 +4,7 @@ # it under the terms of the GNU General Public License version 2 as # published by the Free Software Foundation. -"""Extractors for https://hentai-cosplays.com/ +"""Extractors for https://hentai-cosplay-xxx.com/ (also works for hentai-img.com and porn-images-xxx.com)""" from .common import GalleryExtractor @@ -13,19 +13,21 @@ class HentaicosplaysGalleryExtractor(GalleryExtractor): """Extractor for image galleries from - hentai-cosplays.com, hentai-img.com, and porn-images-xxx.com""" + hentai-cosplay-xxx.com, hentai-img.com, and porn-images-xxx.com""" category = "hentaicosplays" directory_fmt = ("{site}", "{title}") filename_fmt = "{filename}.{extension}" archive_fmt = "{title}_{filename}" pattern = r"((?:https?://)?(?:\w{2}\.)?" \ - r"(hentai-cosplays|hentai-img|porn-images-xxx)\.com)/" \ + r"(hentai-cosplay(?:s|-xxx)|hentai-img|porn-images-xxx)\.com)/" \ r"(?:image|story)/([\w-]+)" - example = "https://hentai-cosplays.com/image/TITLE/" + 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) diff --git a/test/results/hentaicosplays.py b/test/results/hentaicosplays.py index 9760aee88a..5964b445b0 100644 --- a/test/results/hentaicosplays.py +++ b/test/results/hentaicosplays.py @@ -8,11 +8,23 @@ __tests__ = ( +{ + "#url" : "https://hentai-cosplay-xxx.com/image/---devilism--tide-kurihara-/", + "#category": ("", "hentaicosplays", "gallery"), + "#class" : hentaicosplays.HentaicosplaysGalleryExtractor, + "#pattern" : r"https://static\d?\.hentai-cosplay-xxx\.com/upload/\d+/\d+/\d+/\d+\.jpg$", + + "count": 18, + "site" : "hentai-cosplay-xxx", + "slug" : "---devilism--tide-kurihara-", + "title": "艦 こ れ-devilism の tide Kurihara 憂", +}, + { "#url" : "https://hentai-cosplays.com/image/---devilism--tide-kurihara-/", "#category": ("", "hentaicosplays", "gallery"), "#class" : hentaicosplays.HentaicosplaysGalleryExtractor, - "#pattern" : r"https://static\d?.hentai-cosplays.com/upload/\d+/\d+/\d+/\d+.jpg$", + "#pattern" : r"https://static\d?\.hentai-cosplay-xxx\.com/upload/\d+/\d+/\d+/\d+\.jpg$", "count": 18, "site" : "hentai-cosplays",