# -*- coding: utf-8 -*- # 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. """Extractors for https://manganato.com/""" from .common import ChapterExtractor, MangaExtractor from .. import text import re BASE_PATTERN = r"(?:https?://)?((?:chap|read|www\.|m\.)?mangan(?:at|el)o\.com)" class ManganeloChapterExtractor(ChapterExtractor): """Extractor for manga chapters from manganelo.com""" category = "manganelo" root = "https://chapmanganato.com" pattern = BASE_PATTERN + r"(/(?:manga-\w+|chapter/\w+)/chapter[-_][^/?#]+)" test = ( ("https://chapmanganato.com/manga-gn983696/chapter-23", { "pattern": r"https://v\d+\.mkklcdnv6tempv5\.com/img/tab_17/03/23" r"/39/gn983696/vol_3_chapter_23_24_yen/\d+-[no]\.jpg", "keyword": "2c5cd59342f149375df9bcb50aa416b4d04a43cf", "count": 25, }), ("https://chapmanganelo.com/manga-ti107776/chapter-4", { "pattern": r"https://v\d+\.mkklcdnv6tempv5\.com/img/tab_17/01/92" r"/08/ti970565/chapter_4_caster/\d+-o\.jpg", "keyword": "16ac03503c920fb98490ad2c3621c27fddcb6c4b", "count": 45, }), ("https://readmanganato.com/manga-gn983696/chapter-23"), ("https://manganelo.com/chapter/gamers/chapter_15"), ("https://manganelo.com/chapter/gq921227/chapter_23"), ) def __init__(self, match): domain, path = match.groups() ChapterExtractor.__init__(self, match, "https://" + domain + path) self.session.headers['Referer'] = self.root def metadata(self, page): _ , pos = text.extract(page, 'class="a-h"', ">") manga , pos = text.extract(page, 'title="', '"', pos) info , pos = text.extract(page, 'title="', '"', pos) author, pos = text.extract(page, '- Author(s) : ', '
', pos) match = re.match( r"(?:[Vv]ol\. *(\d+) )?" r"[Cc]hapter *([^:]*)" r"(?:: *(.+))?", info) volume, chapter, title = match.groups() if match else ("", "", info) chapter, sep, minor = chapter.partition(".") return { "manga" : text.unescape(manga), "title" : text.unescape(title) if title else "", "author" : text.unescape(author) if author else "", "volume" : text.parse_int(volume), "chapter" : text.parse_int(chapter), "chapter_minor": sep + minor, "lang" : "en", "language" : "English", } def images(self, page): page = text.extr( page, 'class="container-chapter-reader', '\n