Skip to content

Commit

Permalink
[hentaicosplays] support 'hentai-cosplay-xxx.com' (#5959)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Aug 10, 2024
1 parent 87a14a5 commit 8d1805e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/supportedsites.md
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ Consider all listed sites to potentially be NSFW.
</tr>
<tr>
<td>Hentai Cosplay</td>
<td>https://hentai-cosplays.com/</td>
<td>https://hentai-cosplay-xxx.com/</td>
<td>Galleries</td>
<td></td>
</tr>
Expand Down
10 changes: 6 additions & 4 deletions gallery_dl/extractor/hentaicosplays.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)

Expand Down
14 changes: 13 additions & 1 deletion test/results/hentaicosplays.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 8d1805e

Please sign in to comment.