# -*- coding: utf-8 -*- # Copyright 2015-2018 Mike Fährmann # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as # published by the Free Software Foundation. """Extract manga-chapters and entire manga from https://mangapark.me/""" from .common import Extractor, MangaExtractor, Message from .. import text, util from urllib.parse import urljoin class MangaparkExtractor(Extractor): """Base class for mangapark extractors""" category = "mangapark" root = "https://mangapark.me" @staticmethod def parse_chapter_path(path, data): """Get volume/chapter information from url-path of a chapter""" data["volume"], data["chapter_minor"] = 0, "" for part in path.split("/")[3:]: key, value = part[0], part[1:] if key == "s": data["version"] = util.safe_int(value) elif key == "v": data["volume"] = util.safe_int(value) elif key == "c": chapter, dot, minor = value.partition(".") data["chapter"] = util.safe_int(chapter) data["chapter_minor"] = dot + minor elif key == "e": data["chapter_minor"] = "v" + value class MangaparkMangaExtractor(MangaparkExtractor, MangaExtractor): """Extractor for manga from mangapark.me""" pattern = [r"(?:https?://)?(?:www\.)?(mangapark\.me/manga/[^/]+)/?$"] test = [("https://mangapark.me/manga/aria", { "url": "4cb5606530b4eeacde7a4c9fd38296eb6ff46563", "keyword": "e87ab8e7ad2571bbe587881e7fd422e8f582f818", })] def chapters(self, page): results = [] data = {"lang": "en", "language": "English"} data["manga"] = text.unescape( text.extract(page, '