From 005c539829088786f6a87507ada06643b50015c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Fri, 28 Oct 2016 00:35:48 +0200 Subject: [PATCH] improve foolslide volume- and chapter-keywords --- gallery_dl/extractor/dokireader.py | 2 +- gallery_dl/extractor/foolslide.py | 17 +++++++++++------ gallery_dl/extractor/powermanga.py | 2 +- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/gallery_dl/extractor/dokireader.py b/gallery_dl/extractor/dokireader.py index 3af7c227..cee0de79 100644 --- a/gallery_dl/extractor/dokireader.py +++ b/gallery_dl/extractor/dokireader.py @@ -16,7 +16,7 @@ class DokireaderChapterExtractor(FoolslideChapterExtractor): pattern = [(r"(?:https?://)?(kobato\.hologfx\.com/reader/read/" r"[^/]+/([a-z]{2})/\d+/\d+)")] test = [("https://kobato.hologfx.com/reader/read/hitoribocchi_no_oo_seikatsu/en/3/34", { - "keyword": "303f3660772dd393ce01cf248f5cf376629aebc7", + "keyword": "4ee981ae14c6643f6a03a14c9f2c0d4898202671", })] def __init__(self, match): diff --git a/gallery_dl/extractor/foolslide.py b/gallery_dl/extractor/foolslide.py index 64cd050d..9b8dc3d3 100644 --- a/gallery_dl/extractor/foolslide.py +++ b/gallery_dl/extractor/foolslide.py @@ -16,8 +16,8 @@ import re class FoolslideChapterExtractor(Extractor): """Base class for chapter extractors on foolslide based sites""" subcategory = "chapter" - directory_fmt = ["{category}", "{manga}", "c{chapter:>03}{chapter-minor} - {title}"] - filename_fmt = "{manga}_c{chapter:>03}{chapter-minor}_{page:>03}.{extension}" + directory_fmt = ["{category}", "{manga}", "{chapter:>03} - {title}"] + filename_fmt = "{manga}_{chapter:>03}_{page:>03}.{extension}" def __init__(self, url, lang): Extractor.__init__(self) @@ -46,14 +46,19 @@ class FoolslideChapterExtractor(Extractor): _ , pos = text.extract(page, '

', '') manga , pos = text.extract(page, 'title="', '"', pos) chapter , pos = text.extract(page, '">', '', pos) - match = re.match(r"(\w+ (\d+)([^:+]*)(?:: (.*))?|[^:]+)", chapter) + + parts = chapter.split(":", maxsplit=1) + match = re.match(r"(?:Vol.(\d+) )?(?:Chapter (\d+)$|(.+))", parts[0]) + volume = match.group(1) or "" + chapter = match.group(2) or match.group(3).strip() + return { "manga": text.unescape(manga), - "chapter": match.group(2) or match.group(1), - "chapter-minor": match.group(3) or "", + "chapter": chapter, + "volume": volume, "lang": self.lang, "language": iso639_1.code_to_language(self.lang), - "title": text.unescape(match.group(4) or ""), + "title": text.unescape(parts[1].strip() if len(parts) > 1 else ""), } @staticmethod diff --git a/gallery_dl/extractor/powermanga.py b/gallery_dl/extractor/powermanga.py index a12c2a81..3a0f9322 100644 --- a/gallery_dl/extractor/powermanga.py +++ b/gallery_dl/extractor/powermanga.py @@ -21,7 +21,7 @@ class PowermangaChapterExtractor(FoolslideChapterExtractor): ] test = [("https://read.powermanga.org/read/one_piece/en/0/803/page/1", { "url": "e6179c1565068f99180620281f86bdd25be166b4", - "keyword": "17f56ecad0e718735cd832abe84cb3c808cb2a5d", + "keyword": "51cabad8995727334e5ca9773c18d709b3868f02", })] def __init__(self, match):