[mangataro] add support (#8237)

This commit is contained in:
Mike Fährmann
2025-09-19 10:38:34 +02:00
parent 8ee3d9f0bd
commit dbf6de2482
5 changed files with 246 additions and 0 deletions

View File

@@ -619,6 +619,12 @@ Consider all listed sites to potentially be NSFW.
<td>Chapters, Manga</td>
<td></td>
</tr>
<tr id="mangataro" title="mangataro">
<td>MangaTaro</td>
<td>https://mangataro.org/</td>
<td>Chapters, Manga</td>
<td></td>
</tr>
<tr id="mangoxo" title="mangoxo">
<td>Mangoxo</td>
<td>https://www.mangoxo.com/</td>

View File

@@ -120,6 +120,7 @@ modules = [
"manganelo",
"mangapark",
"mangaread",
"mangataro",
"mangoxo",
"misskey",
"motherless",

View File

@@ -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, '<div class="chapter-list', '<div id="tab-gallery"'),
'<a href="', '"'):
chapter, _, chapter_id = url[url.rfind("/")+3:].rpartition("-")
chapter, sep, minor = chapter.partition("-")
results.append((url, {
**manga,
"chapter" : text.parse_int(chapter),
"chapter_minor": f".{minor}" if sep else "",
"chapter_id" : text.parse_int(chapter_id),
}))
return results
@memcache(keyarg=1)
def _manga_info(self, slug):
url = f"{self.root}/manga/{slug}"
page = self.request(url).text
manga = self._extract_jsonld(page)
return {
"manga" : manga["name"].rpartition(" | ")[0].rpartition(" ")[0],
"manga_url" : manga["url"],
"cover" : manga["image"],
"author" : manga["author"]["name"].split(", "),
"genre" : manga["genre"],
"status" : manga["status"],
"description": text.unescape(text.extr(
page, 'id="description-content-tab">', "</div></div>")),
"tags" : text.split_html(text.extr(
page, ">Genres</h4>", "</div>")),
"publisher" : text.remove_html(text.extr(
page, '>Serialization</h4>', "</div>")),
}

View File

@@ -103,6 +103,7 @@ CATEGORY_MAP = {
"itchio" : "itch.io",
"jpgfish" : "JPG Fish",
"kabeuchi" : "かべうち",
"mangataro" : "MangaTaro",
"schalenetwork" : "Schale Network",
"leakgallery" : "Leak Gallery",
"livedoor" : "livedoor Blog",

133
test/results/mangataro.py Normal file
View File

@@ -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" : "<p>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!</p><p>(Source: Kodansha USA)</p></div><div class=\"mt-6 pt-6 border-t border-neutral-700/30\"><div class=\"flex items-center gap-2 mb-3\"> <svg class=\"w-4 h-4 text-neutral-400\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\"> <path stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z\" /> </svg><h4 class=\"text-sm font-medium text-neutral-100\">Background</h4></div><div class=\"max-w-none text-neutral-400 text-justify text-xs\"><p>Majo to Youhei has been published digitally as an English simulpub as The Witch and the Mercenary by Kodansha USA through K Manga.</p>",
"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" : "Its 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" : "<p>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 whos got nothing but the worst routes. This guy, whos 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!</p><p>(Source: Kadokawa, translated)</p>",
"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" : "<p>The everyday life of a poor student, Kamenashi, as documented by his classmate who has a crush on him!</p>",
"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" : "<p>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 Seouls 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]</p></div><div class=\"mt-6 pt-6 border-t border-neutral-700/30\"><div class=\"flex items-center gap-2 mb-3\"> <svg class=\"w-4 h-4 text-neutral-400\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\"> <path stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z\" /> </svg><h4 class=\"text-sm font-medium text-neutral-100\">Background</h4></div><div class=\"max-w-none text-neutral-400 text-justify text-xs\"><p>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.</p>",
"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",
],
},
)