# -*- coding: utf-8 -*- # Copyright 2016-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 comic-issues and entire comics from http://readcomiconline.to/""" from .common import ChapterExtractor, MangaExtractor from .. import text, cloudflare import re class ReadcomiconlineBase(): """Base class for readcomiconline extractors""" category = "readcomiconline" directory_fmt = ["{category}", "{comic}", "{issue:>03}"] filename_fmt = "{comic}_{issue:>03}_{page:>03}.{extension}" archive_fmt = "{issue_id}_{page}" root = "https://readcomiconline.to" useragent = "Wget/1.19.2 (linux-gnu)" request = cloudflare.request_func class ReadcomiconlineComicExtractor(ReadcomiconlineBase, MangaExtractor): """Extractor for comics from readcomiconline.to""" subcategory = "comic" pattern = [r"(?i)(?:https?://)?(?:www\.)?readcomiconline\.to" r"(/Comic/[^/?]+/?)$"] test = [ ("https://readcomiconline.to/Comic/W-i-t-c-h", { "url": "e231bc2a293edb465133c37a8e36a7e7d94cab14", "keyword": "3986248e4458fa44a201ec073c3684917f48ee0c", }), ("https://readcomiconline.to/Comic/Bazooka-Jules", { "url": "711674cb78ed10bd2557315f7a67552d01b33985", "keyword": "f5ba5246cd787bb750924d9690cb1549199bd516", }), ] scheme = "https" def __init__(self, match): MangaExtractor.__init__(self, match, self.root + match.group(1)) self.session.headers["User-Agent"] = self.useragent def chapters(self, page): results = [] comic, pos = text.extract(page, '