# -*- coding: utf-8 -*-
# Copyright 2015 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 pages from http://www.mangahere.co/"""
from .common import Extractor, AsynchronousExtractor, Message
from .. import text
import re
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('