diff --git a/gallery_dl/extractor/rawkuma.py b/gallery_dl/extractor/rawkuma.py index 83a689b9..a4a0c9b2 100644 --- a/gallery_dl/extractor/rawkuma.py +++ b/gallery_dl/extractor/rawkuma.py @@ -7,7 +7,7 @@ """Extractors for https://rawkuma.net/""" from .common import MangaExtractor, ChapterExtractor -from .. import text, util +from .. import text BASE_PATTERN = r"(?:https?://)?rawkuma\.(?:net|com)" @@ -21,37 +21,34 @@ class RawkumaBase(): class RawkumaChapterExtractor(RawkumaBase, ChapterExtractor): """Extractor for manga chapters from rawkuma.net""" archive_fmt = "{chapter_id}_{page}" - pattern = rf"{BASE_PATTERN}/([^/?#]+-chapter-\d+(?:-\d+)?)" - example = "https://rawkuma.net/TITLE-chapter-123/" + pattern = rf"{BASE_PATTERN}(/manga/[^/?#]+/chapter-\d+(?:.\d+)?\.(\d+))" + example = "https://rawkuma.net/manga/7TITLE/chapter-123.321" def __init__(self, match): url = f"{self.root}/{match[1]}/" ChapterExtractor.__init__(self, match, url) def metadata(self, page): - item = util.json_loads(text.extr(page, ',"item":', "}};")) - title = text.rextr( - page, '

").partition(" – ")[2] - date = text.extr(page, 'datetime="', '"') - chapter, sep, minor = item["c"].partition(".") + manga, _, chapter = text.extr( + page, '', "<").rpartition(" Chapter ") + chapter, sep, minor = chapter.partition(" – ")[0].partition(".") return { - "manga" : item["s"], - "manga_id" : text.parse_int(item["mid"]), + "manga" : text.unescape(manga), + "manga_id" : text.parse_int(text.extr(page, "manga_id=", "&")), "chapter" : text.parse_int(chapter), "chapter_minor": sep + minor, - "chapter_id" : text.parse_int(item["cid"]), - "title" : text.unescape(title), - "date" : self.parse_datetime( - date, "%Y-%m-%dWIB%H:%M:%S%z"), - "thumbnail" : item.get("t"), + "chapter_id" : text.parse_int(self.groups[-1]), + # "title" : text.unescape(title), + "date" : self.parse_datetime_iso(text.extr( + page, 'datetime="', '"')), "lang" : "ja", "language" : "Japanese", } def images(self, page): - images = util.json_loads(text.extr(page, '","images":', '}')) - return [(url, None) for url in images] + return [(url, None) for url in text.extract_iter( + page, "<img src='", "'")] class RawkumaMangaExtractor(RawkumaBase, MangaExtractor): @@ -66,18 +63,36 @@ class RawkumaMangaExtractor(RawkumaBase, MangaExtractor): def chapters(self, page): manga = text.unescape(text.extr(page, "<title>", " – ")) + manga_id = text.parse_int(text.extr(page, "manga_id=", "&")) + + url = f"{self.root}/wp-admin/admin-ajax.php" + params = { + "manga_id": manga_id, + "page" : "1", + "action" : "chapter_list", + } + headers = { + "HX-Request" : "true", + "HX-Trigger" : "chapter-list", + "HX-Target" : "chapter-list", + "HX-Current-URL": self.page_url, + "Sec-Fetch-Dest": "empty", + "Sec-Fetch-Mode": "cors", + "Sec-Fetch-Site": "same-origin", + } + html = self.request(url, params=params, headers=headers).text results = [] - for chbox in text.extract_iter( - page, '<li data-num="', "</a>"): - info = text.extr(chbox, '', '"') - chapter, _, title = info.partition(" - ") + for url in text.extract_iter(html, '<a href="', '"'): + info = url[url.rfind("-")+1:-1] + chapter, _, chapter_id = info.rpartition(".") chapter, sep, minor = chapter.partition(".") - results.append((text.extr(chbox, 'href="', '"'), { + results.append((url, { "manga" : manga, + "manga_id" : manga_id, "chapter" : text.parse_int(chapter), "chapter-minor": sep + minor, - "title" : title, + "chapter_id" : text.parse_int(chapter_id), })) return results diff --git a/test/results/rawkuma.py b/test/results/rawkuma.py index dab14b7a..f27c87ff 100644 --- a/test/results/rawkuma.py +++ b/test/results/rawkuma.py @@ -9,57 +9,56 @@ from gallery_dl.extractor import rawkuma __tests__ = ( { - "#url" : "https://rawkuma.net/hitman-chapter-127/", + "#url" : "https://rawkuma.net/manga/saikyou-onmyouji-no-isekai-tenseiki-geboku-no-youkaidomo-ni-kurabete-monster-ga-yowaisugirundaga/chapter-3.28214/", "#class" : rawkuma.RawkumaChapterExtractor, - "#pattern" : r"https://cdn.kumacdn.club/wp-content/uploads/images/h/hitman/chapter-127/.+\.jpg$", - "#count" : 18, + "#pattern" : r"https://rcdn\.kyut\.dev/s/saikyou\-onmyouji\-no\-isekai\-tenseiki\-geboku\-no\-youkaidomo\-ni\-kurabete\-monster\-ga\-yowaisugirundaga/chapter\-3/\d+\.png", + "#count" : 28, - "chapter" : 127, - "chapter_id" : 313750, + "chapter" : 3, + "chapter_id" : 28214, "chapter_minor": "", - "count" : 18, - "date" : "dt:2021-07-01 07:07:27", - "extension" : "jpg", + "count" : 28, + "page" : range(1, 28), + "date" : "dt:2025-09-14 15:57:26", + "extension" : "png", "filename" : str, "lang" : "ja", "language" : "Japanese", - "manga" : "Hitman", - "manga_id" : 47920, - "page" : range(1, 18), - "thumbnail" : "https://rawkuma.net/wp-content/uploads/2020/10/Hitman-10.jpg", - "title" : "End", + "manga" : "Saikyou Onmyouji no Isekai Tenseiki ~Geboku no Youkaidomo ni Kurabete Monster ga Yowaisugirundaga~", + "manga_id" : 784, }, { - "#url" : "https://rawkuma.net/saikyou-inyoushi-no-isekai-tenseiki-chapter-8-1/", + "#url" : "https://rawkuma.net/manga/makutsu-no-ou-yomei-ikkagetsu-no-doutei-mahou-shoujo-harem-o-kizuite-ou-e-kunrinsu/chapter-3.4.205398/", "#class" : rawkuma.RawkumaChapterExtractor, - "#pattern" : r"https://cdn.kumacdn.club/wp-content/uploads/images/s/saikyou-inyoushi-no-isekai-tenseiki/chapter-8-1/.+\.jpg$", + "#pattern" : r"https://rcdn\.kyut\.dev/m/makutsu\-no\-ou\-yomei\-ikkagetsu\-no\-doutei\-mahou\-shoujo\-harem\-o\-kizuite\-ou\-e\-kunrinsu/chapter\-3\-4/\d+\.jpg", + "#count" : 10, - "chapter" : 8, - "chapter_id" : 85076, - "chapter_minor": ".1", - "count" : 11, - "date" : "dt:2023-11-21 06:27:19", + "chapter" : 3, + "chapter_id" : 205398, + "chapter_minor": ".4", + "count" : 10, + "page" : range(1, 10), + "date" : "dt:2025-10-03 17:41:22", "extension" : "jpg", "filename" : str, "lang" : "ja", "language" : "Japanese", - "manga" : "Saikyou Inyoushi no Isekai Tenseiki", - "manga_id" : 20781, - "page" : range(1, 11), - "thumbnail" : "https://rawkuma.net/wp-content/uploads/2020/06/Saikyou-Inyoushi-no-Isekai-Tenseiki-cover.jpg", - "title" : "", + "manga" : "Makutsu no Ou ~Yomei Ikkagetsu no Doutei, Mahou Shoujo Harem o Kizuite Ou e Kunrinsu~", + "manga_id" : 194526, }, { - "#url" : "https://rawkuma.net/manga/hitman/", + "#url" : "https://rawkuma.net/manga/makutsu-no-ou-yomei-ikkagetsu-no-doutei-mahou-shoujo-harem-o-kizuite-ou-e-kunrinsu", "#class" : rawkuma.RawkumaMangaExtractor, "#pattern" : rawkuma.RawkumaChapterExtractor.pattern, + "#count" : range(32, 50), - "chapter" : range(1, 127), - "chapter-minor": {"", ".5"}, - "manga" : "Hitman", - "title" : {"", "End"}, + "chapter" : range(1, 20), + "chapter-minor": {"", ".1", ".2", ".3", ".4"}, + "chapter_id" : int, + "manga" : "Makutsu no Ou ~Yomei Ikkagetsu no Doutei, Mahou Shoujo Harem o Kizuite Ou e Kunrinsu~", + "manga_id" : 194526, }, )