[batoto] fix downloading manga with alerts/notices (#7657)

and improve alert message extraction
This commit is contained in:
Mike Fährmann
2025-06-12 08:24:43 +02:00
parent 847fce6ef1
commit 16fc5e0d68
2 changed files with 18 additions and 5 deletions

View File

@@ -7,7 +7,7 @@
"""Extractors for https://bato.to/"""
from .common import Extractor, ChapterExtractor, MangaExtractor
from .. import text, util, exception
from .. import text, util
BASE_PATTERN = (r"(?:https?://)?("
r"(?:ba|d|f|h|j|m|w)to\.to|"
@@ -152,9 +152,9 @@ class BatotoMangaExtractor(BatotoBase, MangaExtractor):
def chapters(self, page):
extr = text.extract_from(page)
warning = extr(' class="alert alert-warning">', "</div><")
warning = extr(' class="alert alert-warning">', "</div>")
if warning:
raise exception.StopExtraction("'%s'", text.remove_html(warning))
self.log.warning("'%s'", text.remove_html(warning))
data = {
"manga_id": text.parse_int(self.manga_id),

View File

@@ -5,7 +5,6 @@
# published by the Free Software Foundation.
from gallery_dl.extractor import batoto
from gallery_dl import exception
__tests__ = (
{
@@ -133,7 +132,21 @@ __tests__ = (
"#url" : "https://bato.to/title/134270-removed",
"#comment" : "Deleted/removed manga",
"#class" : batoto.BatotoMangaExtractor,
"#exception": exception.StopExtraction,
"#log" : "'This comic has been marked as deleted and the chapter list is not available.'",
"#count" : 0,
},
{
"#url" : "https://mto.to/series/136193",
"#comment" : "uploader notice (#7657)",
"#category": ("", "batoto", "manga"),
"#class" : batoto.BatotoMangaExtractor,
"#log" : "'UPLOADER NOTICE - The comic was deleted off EbookRenta :/'",
"#urls" : (
"https://mto.to/title/136193-botsuraku-sunzen-desunode-konyakusha-o-furikiro-to-omoimasu-official/2456573-ch_1",
"https://mto.to/title/136193-botsuraku-sunzen-desunode-konyakusha-o-furikiro-to-omoimasu-official/2713985-ch_2",
"https://mto.to/title/136193-botsuraku-sunzen-desunode-konyakusha-o-furikiro-to-omoimasu-official/2739046-ch_3",
),
},
{