From 88739a3564f4a4e3c16efc018ca454af9d924950 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Sat, 28 Nov 2015 00:11:28 +0100 Subject: [PATCH] [mangahere] add manga-extractor --- gallery_dl/extractor/mangahere.py | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/gallery_dl/extractor/mangahere.py b/gallery_dl/extractor/mangahere.py index 2df004b1..884e3bf8 100644 --- a/gallery_dl/extractor/mangahere.py +++ b/gallery_dl/extractor/mangahere.py @@ -12,7 +12,35 @@ from .common import AsynchronousExtractor, Message from .. import text import re -class MangaHereExtractor(AsynchronousExtractor): +class MangaHereMangaExtractor(Extractor): + + category = "mangahere" + directory_fmt = ["{category}", "{manga}", "c{chapter:>03}"] + filename_fmt = "{manga}_c{chapter:>03}_{page:>03}.{extension}" + pattern = [r"(?:https?://)?(?:www\.)?mangahere\.co/manga/([^/]+)/?$"] + + def __init__(self, match): + Extractor.__init__(self) + self.url = match.group(0) + "/" + + def items(self): + yield Message.Version, 1 + for chapter in self.get_chapters(): + yield Message.Queue, chapter + + def get_chapters(self): + page = self.request(self.url).text + pos = page.index('
') + chapters = [] + while True: + url, pos = text.extract(page, '03}"]