summaryrefslogtreecommitdiffstats
path: root/gallery_dl/extractor/hentai2read.py
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@unit193.net>2022-11-01 21:32:54 -0400
committerLibravatarUnit 193 <unit193@unit193.net>2022-11-01 21:32:54 -0400
commite59d46ecda74190381b1d2725b0bd9df5c0be8d8 (patch)
treecff6d69d4f68ef011a496ff2311173ebef70bf3f /gallery_dl/extractor/hentai2read.py
parent78e2d1672e4301497f786cd03637de9ddbc717ac (diff)
New upstream version 1.23.5.upstream/1.23.5
Diffstat (limited to 'gallery_dl/extractor/hentai2read.py')
-rw-r--r--gallery_dl/extractor/hentai2read.py82
1 files changed, 64 insertions, 18 deletions
diff --git a/gallery_dl/extractor/hentai2read.py b/gallery_dl/extractor/hentai2read.py
index 53be67b..dc4e31d 100644
--- a/gallery_dl/extractor/hentai2read.py
+++ b/gallery_dl/extractor/hentai2read.py
@@ -1,12 +1,12 @@
# -*- coding: utf-8 -*-
-# Copyright 2016-2019 Mike Fährmann
+# Copyright 2016-2022 Mike Fährmann
#
# 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.
-"""Extract hentai-manga from https://hentai2read.com/"""
+"""Extractors for https://hentai2read.com/"""
from .common import ChapterExtractor, MangaExtractor
from .. import text
@@ -23,11 +23,32 @@ class Hentai2readBase():
class Hentai2readChapterExtractor(Hentai2readBase, ChapterExtractor):
"""Extractor for a single manga chapter from hentai2read.com"""
archive_fmt = "{chapter_id}_{page}"
- pattern = r"(?:https?://)?(?:www\.)?hentai2read\.com(/[^/?#]+/(\d+))"
- test = ("https://hentai2read.com/amazon_elixir/1/", {
- "url": "964b942cf492b3a129d2fe2608abfc475bc99e71",
- "keyword": "ff84b8f751f0e4ee37717efc4332ff1db71951d9",
- })
+ pattern = r"(?:https?://)?(?:www\.)?hentai2read\.com(/[^/?#]+/([^/?#]+))"
+ test = (
+ ("https://hentai2read.com/amazon_elixir/1/", {
+ "url": "964b942cf492b3a129d2fe2608abfc475bc99e71",
+ "keyword": "85645b02d34aa11b3deb6dadd7536863476e1bad",
+ }),
+ ("https://hentai2read.com/popuni_kei_joshi_panic/2.5/", {
+ "pattern": r"https://hentaicdn\.com/hentai"
+ r"/13088/2\.5y/ccdn00\d+\.jpg",
+ "count": 36,
+ "keyword": {
+ "author": "Kurisu",
+ "chapter": 2,
+ "chapter_id": 75152,
+ "chapter_minor": ".5",
+ "count": 36,
+ "lang": "en",
+ "language": "English",
+ "manga": "Popuni Kei Joshi Panic!",
+ "manga_id": 13088,
+ "page": int,
+ "title": "Popuni Kei Joshi Panic! 2.5",
+ "type": "Original",
+ },
+ }),
+ )
def __init__(self, match):
self.chapter = match.group(2)
@@ -37,12 +58,14 @@ class Hentai2readChapterExtractor(Hentai2readBase, ChapterExtractor):
title, pos = text.extract(page, "<title>", "</title>")
manga_id, pos = text.extract(page, 'data-mid="', '"', pos)
chapter_id, pos = text.extract(page, 'data-cid="', '"', pos)
+ chapter, sep, minor = self.chapter.partition(".")
match = re.match(r"Reading (.+) \(([^)]+)\) Hentai(?: by (.+))? - "
- r"(\d+): (.+) . Page 1 ", title)
+ r"([^:]+): (.+) . Page 1 ", title)
return {
"manga": match.group(1),
"manga_id": text.parse_int(manga_id),
- "chapter": text.parse_int(self.chapter),
+ "chapter": text.parse_int(chapter),
+ "chapter_minor": sep + minor,
"chapter_id": text.parse_int(chapter_id),
"type": match.group(2),
"author": match.group(3),
@@ -51,8 +74,7 @@ class Hentai2readChapterExtractor(Hentai2readBase, ChapterExtractor):
"language": "English",
}
- @staticmethod
- def images(page):
+ def images(self, page):
images = text.extract(page, "'images' : ", ",\n")[0]
return [
("https://hentaicdn.com/hentai" + part, None)
@@ -67,18 +89,35 @@ class Hentai2readMangaExtractor(Hentai2readBase, MangaExtractor):
test = (
("https://hentai2read.com/amazon_elixir/", {
"url": "273073752d418ec887d7f7211e42b832e8c403ba",
- "keyword": "13c1ce7e15cbb941f01c843b0e89adc993d939ac",
+ "keyword": "5c1b712258e78e120907121d3987c71f834d13e1",
}),
("https://hentai2read.com/oshikage_riot/", {
"url": "6595f920a3088a15c2819c502862d45f8eb6bea6",
- "keyword": "675c7b7a4fa52cf569c283553bd16b4200a5cd36",
+ "keyword": "a2e9724acb221040d4b29bf9aa8cb75b2240d8af",
+ }),
+ ("https://hentai2read.com/popuni_kei_joshi_panic/", {
+ "pattern": Hentai2readChapterExtractor.pattern,
+ "range": "2-3",
+ "keyword": {
+ "chapter": int,
+ "chapter_id": int,
+ "chapter_minor": ".5",
+ "lang": "en",
+ "language": "English",
+ "manga": "Popuni Kei Joshi Panic!",
+ "manga_id": 13088,
+ "title": str,
+ "type": "Original",
+ },
}),
)
def chapters(self, page):
results = []
+
+ pos = page.find('itemscope itemtype="http://schema.org/Book') + 1
manga, pos = text.extract(
- page, '<span itemprop="name">', '</span>')
+ page, '<span itemprop="name">', '</span>', pos)
mtype, pos = text.extract(
page, '<small class="text-danger">[', ']</small>', pos)
manga_id = text.parse_int(text.extract(
@@ -90,12 +129,19 @@ class Hentai2readMangaExtractor(Hentai2readBase, MangaExtractor):
return results
_ , pos = text.extract(page, ' href="', '"', pos)
url, pos = text.extract(page, ' href="', '"', pos)
- chapter, pos = text.extract(page, '>', '<', pos)
+ chapter, pos = text.extract(page, '>', '<', pos)
chapter, _, title = text.unescape(chapter).strip().partition(" - ")
+ chapter, sep, minor = chapter.partition(".")
+
results.append((url, {
- "manga_id": manga_id, "manga": manga, "type": mtype,
- "chapter_id": text.parse_int(chapter_id),
+ "manga": manga,
+ "manga_id": manga_id,
"chapter": text.parse_int(chapter),
- "title": title, "lang": "en", "language": "English",
+ "chapter_minor": sep + minor,
+ "chapter_id": text.parse_int(chapter_id),
+ "type": mtype,
+ "title": title,
+ "lang": "en",
+ "language": "English",
}))