From dbf6de24826799df152ec295958c54434e6883f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Fri, 19 Sep 2025 10:38:34 +0200 Subject: [PATCH] [mangataro] add support (#8237) --- docs/supportedsites.md | 6 ++ gallery_dl/extractor/__init__.py | 1 + gallery_dl/extractor/mangataro.py | 105 +++++++++++++++++++++++ scripts/supportedsites.py | 1 + test/results/mangataro.py | 133 ++++++++++++++++++++++++++++++ 5 files changed, 246 insertions(+) create mode 100644 gallery_dl/extractor/mangataro.py create mode 100644 test/results/mangataro.py diff --git a/docs/supportedsites.md b/docs/supportedsites.md index 29e92be0..727f4124 100644 --- a/docs/supportedsites.md +++ b/docs/supportedsites.md @@ -619,6 +619,12 @@ Consider all listed sites to potentially be NSFW. Chapters, Manga + + MangaTaro + https://mangataro.org/ + Chapters, Manga + + Mangoxo https://www.mangoxo.com/ diff --git a/gallery_dl/extractor/__init__.py b/gallery_dl/extractor/__init__.py index 823ec942..83cebc1f 100644 --- a/gallery_dl/extractor/__init__.py +++ b/gallery_dl/extractor/__init__.py @@ -120,6 +120,7 @@ modules = [ "manganelo", "mangapark", "mangaread", + "mangataro", "mangoxo", "misskey", "motherless", diff --git a/gallery_dl/extractor/mangataro.py b/gallery_dl/extractor/mangataro.py new file mode 100644 index 00000000..f4cc0582 --- /dev/null +++ b/gallery_dl/extractor/mangataro.py @@ -0,0 +1,105 @@ +# -*- coding: utf-8 -*- + +# Copyright 2025 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. + +"""Extractors for https://mangataro.org/""" + +from .common import ChapterExtractor, MangaExtractor +from .. import text +from ..cache import memcache + +BASE_PATTERN = r"(?:https?://)?mangataro\.org" + + +class MangataroBase(): + """Base class for mangataro extractors""" + category = "mangataro" + root = "https://mangataro.org" + + +class MangataroChapterExtractor(MangataroBase, ChapterExtractor): + """Extractor for mangataro manga chapters""" + pattern = rf"{BASE_PATTERN}(/read/([^/?#]+)/(?:[^/?#]*-)?(\d+))" + example = "https://mangataro.org/read/MANGA/ch123-12345" + + def metadata(self, page): + _, slug, chapter_id = self.groups + comic = self._extract_jsonld(page)["@graph"][0] + chapter = comic["position"] + minor = chapter - int(chapter) + desc = comic["description"].split(" - ", 3) + + return { + **_manga_info(self, slug), + "title" : desc[1] if len(desc) > 3 else "", + "chapter" : int(chapter), + "chapter_minor": str(round(minor, 5))[1:] if minor else "", + "chapter_id" : text.parse_int(chapter_id), + "chapter_url" : comic["url"], + "date" : text.parse_datetime( + comic["datePublished"], "%Y-%m-%dT%H:%M:%S%z"), + "date_updated" : text.parse_datetime( + comic["dateModified"], "%Y-%m-%dT%H:%M:%S%z"), + } + + def images(self, page): + pos = page.find('class="comic-image-container') + img, pos = text.extract(page, ' src="', '"', pos) + + images = [(img, None)] + images.extend( + (url, None) + for url in text.extract_iter(page, 'data-src="', '"', pos) + ) + return images + + +class MangataroMangaExtractor(MangataroBase, MangaExtractor): + """Extractor for mangataro manga""" + chapterclass = MangataroChapterExtractor + pattern = rf"{BASE_PATTERN}(/manga/([^/?#]+))" + example = "https://mangataro.org/manga/MANGA" + + def chapters(self, page): + slug = self.groups[1] + manga = _manga_info(self, slug) + + results = [] + for url in text.extract_iter(text.extr( + page, '
', "
")), + "tags" : text.split_html(text.extr( + page, ">Genres", "")), + "publisher" : text.remove_html(text.extr( + page, '>Serialization', "")), + } diff --git a/scripts/supportedsites.py b/scripts/supportedsites.py index 0cd5f400..419ec6b8 100755 --- a/scripts/supportedsites.py +++ b/scripts/supportedsites.py @@ -103,6 +103,7 @@ CATEGORY_MAP = { "itchio" : "itch.io", "jpgfish" : "JPG Fish", "kabeuchi" : "かべうち", + "mangataro" : "MangaTaro", "schalenetwork" : "Schale Network", "leakgallery" : "Leak Gallery", "livedoor" : "livedoor Blog", diff --git a/test/results/mangataro.py b/test/results/mangataro.py new file mode 100644 index 00000000..a27dc932 --- /dev/null +++ b/test/results/mangataro.py @@ -0,0 +1,133 @@ +# -*- coding: utf-8 -*- + +# 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. + +from gallery_dl.extractor import mangataro + + +__tests__ = ( +{ + "#url" : "https://mangataro.org/read/majo-to-youhei/ch8-356833", + "#class" : mangataro.MangataroChapterExtractor, + "#pattern" : r"https://bx1\.mangapeak\.me/storage/chapters/b99b2860f0444d924c9446b4ecf1cdad/\d+\.webp", + "#count" : 22, + + "chapter" : 8, + "chapter_minor": "", + "chapter_id" : 356833, + "chapter_url" : "https://mangataro.org/read/majo-to-youhei/ch8-356833", + "count" : 22, + "page" : range(1, 22), + "cover" : "https://mangataro.org/content/media/301979l.jpg", + "date" : "dt:2025-05-03 19:04:48", + "date_updated" : "dt:2025-05-03 19:04:53", + "description" : "

Zig—a tall, broad-shouldered mercenary—participates in a witch hunt. Following a fierce duel with the deadly witch, he becomes privy to her desire. “I want you to protect me,” she requests, tired of having her life trivialized. Seeking a place to survive, the witch and the mercenary set their sights on an unknown continent!

(Source: Kodansha USA)

Background

Majo to Youhei has been published digitally as an English simulpub as The Witch and the Mercenary by Kodansha USA through K Manga.

", + "filename" : str, + "extension" : "webp", + "genre" : "Manga", + "manga" : "Majo to Youhei", + "manga_url" : "https://mangataro.org/manga/majo-to-youhei", + "publisher" : "Magazine pocket", + "status" : "Ongoing", + "title" : "It’s Just a Knife", + "author" : [ + "Miyagi", + "Makoto", + "Chouhoukiteki", + "Kaeru", + ], + "tags" : [ + "Action", + "Fantasy", + ], +}, + +{ + "#url" : "https://mangataro.org/read/sono-akuyaku-kizoku-mama-heroine-ga-sukisugiru-shinshi-na-doryoku-de-saikyou-to-nari-fuguu-na-oshi-chara-tasukemakuru/ch12-2-337633", + "#class" : mangataro.MangataroChapterExtractor, + "#pattern" : r"https://bx1\.mangapeak\.me/storage/chapters/200aa5d11c6ef1f049a2c68163c3a1d7/\d+\.webp", + "#count" : 13, + + "chapter" : 12, + "chapter_minor": ".2", + "chapter_id" : 337633, + "chapter_url" : "https://mangataro.org/read/sono-akuyaku-kizoku-mama-heroine-ga-sukisugiru-shinshi-na-doryoku-de-saikyou-to-nari-fuguu-na-oshi-chara-tasukemakuru/ch12-2-337633", + "count" : 13, + "page" : range(1, 13), + "cover" : "https://mangataro.org/content/media/317553l.webp", + "date" : "dt:2025-04-25 14:25:53", + "date_updated" : "dt:2025-04-25 14:25:57", + "description" : "

The mom characters that appear in the game are all unfortunate sub-heroines who always get bad ending routes. “Why… Why does such a cute mom have to die?!” Even though the protagonist tried very hard to request a route where they get saved, all of his efforts were in vain, making him spend his days in frustration. Then, he suddenly gets reincarnated into the world of MamaFan on a certain day. …However, he gets reincarnated as a villainous aristocrat who’s got nothing but the worst routes. This guy, who’s crazy about mom characters—his fulfilling days of saving his beloved mom characters and his journey to create his harem full of plump women are about to begin!

(Source: Kadokawa, translated)

", + "filename" : str, + "extension" : "webp", + "genre" : "Manga", + "manga" : "The Villainous Noble Loves Mom Heroines Too Much: Becoming The Strongest With Sincere Effort To Save Misfortunate Fave Chars", + "manga_url" : "https://mangataro.org/manga/sono-akuyaku-kizoku-mama-heroine-ga-sukisugiru-shinshi-na-doryoku-de-saikyou-to-nari-fuguu-na-oshi-chara-tasukemakuru", + "publisher" : "Web Comic Apanta", + "status" : "Ongoing", + "title" : "", + "author" : [ + "Nozomi", + "Kota", + "Oomine", + ], + "tags" : [ + "Fantasy", + "Ecchi", + ], +}, + +{ + "#url" : "https://mangataro.org/manga/hinmin-choujin-kanenashi-kun", + "#class" : mangataro.MangataroMangaExtractor, + "#pattern" : mangataro.MangataroChapterExtractor.pattern, + "#count" : 47, + + "author" : ["Pageratta"], + "chapter" : int, + "chapter_id" : int, + "chapter_minor": {"", ".5", ".9"}, + "cover" : "https://mangataro.org/content/media/199106l.webp", + "description" : "

The everyday life of a poor student, Kamenashi, as documented by his classmate who has a crush on him!

", + "genre" : "Manga", + "manga" : "Hinmin Choujin Kanenashi-kun", + "manga_url" : "https://mangataro.org/manga/hinmin-choujin-kanenashi-kun", + "publisher" : "Shounen Jump+", + "status" : "Completed", + "tags" : [ + "Comedy", + "Romance", + ], +}, + +{ + "#url" : "https://mangataro.org/manga/lookism", + "#class" : mangataro.MangataroMangaExtractor, + "#pattern" : mangataro.MangataroChapterExtractor.pattern, + "#count" : 573, + + "chapter" : range(1, 573), + "chapter_id" : int, + "chapter_minor": "", + "cover" : "https://mangataro.org/content/media/208866l.webp", + "description" : "

Park Hyung Suk has spent all 17 years of his life at the bottom of the food chain. Short, overweight, and unattractive, he is used to being bullied by his classmates and constantly discriminated against for his looks. In an attempt to escape his biggest bully, Lee Tae Sung, he decides to transfer to Seoul’s Jae Won High School, a vocational preparatory school notorious for its liberal education system and carefree students. Days before his transfer, Hyung Suk wakes to find that he is no longer in his usual chubby body, but is instead in a perfect body! Tall, handsome, and beautifully toned, Hyung Suk has become the ideal version of himself. The only problem is that his original body still lays beside him—and when one body falls asleep, he awakens in the other. Now possessing two extremely different bodies, Hyung Suk must learn to navigate his new and much more popular life at J High whilst also solving the mystery of where his second, almost superhuman, body came from. [Written by MAL Rewrite]

Background

Lookism is originally a webtoon which first volume was officially published in paperbook format by &Book (대원앤북) on May 25, 2017. The series has been serialized in English by LINE Webtoon since June 4, 2017.

", + "genre" : "Manhwa", + "manga" : "Lookism", + "manga_url" : "https://mangataro.org/manga/lookism", + "publisher" : "Naver Webtoon", + "status" : "Ongoing", + "author" : [ + "Park", + "Tae-Jun", + ], + "tags" : [ + "Action", + "Comedy", + "Drama", + "Supernatural", + ], +}, + +)