From 20efe49f83662b065ef767102ad3e601f67bd24c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Thu, 26 Nov 2015 23:32:16 +0100 Subject: [PATCH] [mangareader] unify extractor metadata in base class --- gallery_dl/extractor/mangareader.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/gallery_dl/extractor/mangareader.py b/gallery_dl/extractor/mangareader.py index f43a017c..681fbad9 100644 --- a/gallery_dl/extractor/mangareader.py +++ b/gallery_dl/extractor/mangareader.py @@ -11,14 +11,18 @@ from .common import AsynchronousExtractor, Extractor, Message from .. import text -class MangaReaderExtractor(Extractor): +class MangaReaderBase(): category = "mangareader" directory_fmt = ["{category}", "{manga}", "c{chapter:>03} - {title}"] filename_fmt = "{manga}_c{chapter:>03}_{page:>03}.{extension}" - pattern = [r"(?:https?://)?(?:www\.)?mangareader\.net(/[^/]+)$"] url_base = "http://www.mangareader.net" + +class MangaReaderMangaExtractor(MangaReaderBase, Extractor): + + pattern = [r"(?:https?://)?(?:www\.)?mangareader\.net(/[^/]+)$"] + def __init__(self, match): Extractor.__init__(self) self.url_title = match.group(1) @@ -33,18 +37,15 @@ class MangaReaderExtractor(Extractor): chapter, pos = text.extract(page, needle, '"', pos) if not chapter: return - print(url + chapter) yield Message.Queue, url + chapter -class MangaReaderChapterExtractor(AsynchronousExtractor): - category = "mangareader" - directory_fmt = ["{category}", "{manga}", "c{chapter:>03} - {title}"] - filename_fmt = "{manga}_c{chapter:>03}_{page:>03}.{extension}" + +class MangaReaderChapterExtractor(MangaReaderBase, AsynchronousExtractor): + pattern = [ r"(?:https?://)?(?:www\.)?mangareader\.net((/[^/]+)/(\d+))", r"(?:https?://)?(?:www\.)?mangareader\.net(/\d+-\d+-\d+(/[^/]+)/chapter-(\d+).html)", ] - url_base = "http://www.mangareader.net" def __init__(self, match): AsynchronousExtractor.__init__(self)