[mangareader] unify extractor metadata in base class

This commit is contained in:
Mike Fährmann 2015-11-26 23:32:16 +01:00
parent d5349c8cb5
commit 20efe49f83
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

View File

@ -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)