docstrings

This commit is contained in:
Mike Fährmann 2015-11-28 22:21:35 +01:00
parent 9cb184d409
commit f48712c9c9
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
5 changed files with 20 additions and 19 deletions

View File

@ -6,14 +6,14 @@
# it under the terms of the GNU General Public License version 2 as # it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation. # published by the Free Software Foundation.
"""Extract manga pages from http://kissmanga.com/""" """Extract manga-chapters and entire manga from http://kissmanga.com/"""
from .common import Extractor, Message from .common import Extractor, Message
from .. import text, cloudflare from .. import text, cloudflare
import re import re
class KissmangaExtractor(Extractor): class KissmangaExtractor(Extractor):
"""Base class for kissmanga extractors"""
category = "kissmanga" category = "kissmanga"
directory_fmt = ["{category}", "{manga}", "c{chapter:>03}{chapter-minor} - {title}"] directory_fmt = ["{category}", "{manga}", "c{chapter:>03}{chapter-minor} - {title}"]
filename_fmt = "{manga}_c{chapter:>03}{chapter-minor}_{page:>03}.{extension}" filename_fmt = "{manga}_c{chapter:>03}{chapter-minor}_{page:>03}.{extension}"
@ -25,7 +25,7 @@ class KissmangaExtractor(Extractor):
class KissmangaMangaExtractor(KissmangaExtractor): class KissmangaMangaExtractor(KissmangaExtractor):
"""Extract all manga-chapters from kissmanga"""
pattern = [r"(?:https?://)?(?:www\.)?kissmanga\.com/Manga/[^/]+/?$"] pattern = [r"(?:https?://)?(?:www\.)?kissmanga\.com/Manga/[^/]+/?$"]
def items(self): def items(self):
@ -43,7 +43,7 @@ class KissmangaMangaExtractor(KissmangaExtractor):
class KissmangaChapterExtractor(KissmangaExtractor): class KissmangaChapterExtractor(KissmangaExtractor):
"""Extract a single manga-chapter from kissmanga"""
pattern = [r"(?:https?://)?(?:www\.)?kissmanga\.com/Manga/.+/.+\?id=\d+"] pattern = [r"(?:https?://)?(?:www\.)?kissmanga\.com/Manga/.+/.+\?id=\d+"]
def items(self): def items(self):

View File

@ -6,14 +6,14 @@
# it under the terms of the GNU General Public License version 2 as # it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation. # published by the Free Software Foundation.
"""Extract manga pages from http://www.mangahere.co/""" """Extract manga-chapters and entire manga from from http://www.mangahere.co/"""
from .common import Extractor, AsynchronousExtractor, Message from .common import Extractor, AsynchronousExtractor, Message
from .. import text from .. import text
import re import re
class MangaHereMangaExtractor(Extractor): class MangaHereMangaExtractor(Extractor):
"""Extract all manga-chapters from mangahere"""
category = "mangahere" category = "mangahere"
directory_fmt = ["{category}", "{manga}", "c{chapter:>03}"] directory_fmt = ["{category}", "{manga}", "c{chapter:>03}"]
filename_fmt = "{manga}_c{chapter:>03}_{page:>03}.{extension}" filename_fmt = "{manga}_c{chapter:>03}_{page:>03}.{extension}"
@ -29,6 +29,7 @@ class MangaHereMangaExtractor(Extractor):
yield Message.Queue, chapter yield Message.Queue, chapter
def get_chapters(self): def get_chapters(self):
"""Return a list of all chapter urls"""
page = self.request(self.url).text page = self.request(self.url).text
return reversed(list( return reversed(list(
text.extract_iter(page, '<a class="color_0077" href="', '"', text.extract_iter(page, '<a class="color_0077" href="', '"',
@ -37,7 +38,7 @@ class MangaHereMangaExtractor(Extractor):
class MangaHereChapterExtractor(AsynchronousExtractor): class MangaHereChapterExtractor(AsynchronousExtractor):
"""Extract a single manga-chapter from mangahere"""
category = "mangahere" category = "mangahere"
directory_fmt = ["{category}", "{manga}", "c{chapter:>03}{chapter-minor}"] directory_fmt = ["{category}", "{manga}", "c{chapter:>03}{chapter-minor}"]
filename_fmt = "{manga}_c{chapter:>03}{chapter-minor}_{page:>03}.{extension}" filename_fmt = "{manga}_c{chapter:>03}{chapter-minor}_{page:>03}.{extension}"

View File

@ -6,14 +6,14 @@
# it under the terms of the GNU General Public License version 2 as # it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation. # published by the Free Software Foundation.
"""Extract manga pages from https://www.mangamint.com/""" """Extract manga-chapters and entire manga from https://www.mangamint.com/"""
from .common import Extractor, Message from .common import Extractor, Message
from .. import text from .. import text
import re import re
class MangaMintMangaExtractor(Extractor): class MangaMintMangaExtractor(Extractor):
"""Extract all manga-chapters from mangamint"""
category = "mangamint" category = "mangamint"
directory_fmt = ["{category}", "{manga}", "c{chapter:>03}"] directory_fmt = ["{category}", "{manga}", "c{chapter:>03}"]
filename_fmt = "{manga}_c{chapter:>03}_{page:>03}.{extension}" filename_fmt = "{manga}_c{chapter:>03}_{page:>03}.{extension}"
@ -45,7 +45,7 @@ class MangaMintMangaExtractor(Extractor):
class MangaMintChapterExtractor(Extractor): class MangaMintChapterExtractor(Extractor):
"""Extract a single manga-chapter from mangamint"""
category = "mangamint" category = "mangamint"
directory_fmt = ["{category}", "{manga}", "c{chapter:>03}{chapter-minor}"] directory_fmt = ["{category}", "{manga}", "c{chapter:>03}{chapter-minor}"]
filename_fmt = "{manga}_c{chapter:>03}{chapter-minor}_{page:>03}.{extension}" filename_fmt = "{manga}_c{chapter:>03}{chapter-minor}_{page:>03}.{extension}"

View File

@ -6,23 +6,23 @@
# it under the terms of the GNU General Public License version 2 as # it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation. # published by the Free Software Foundation.
"""Extract manga pages from http://www.mangapanda.com/""" """Extract manga-chapters and entire manga from http://www.mangapanda.com/"""
from .mangareader import * from .mangareader import MangaReaderMangaExtractor, MangaReaderChapterExtractor
class MangaPandaBase(): class MangaPandaBase():
"""Base class for mangapanda extractors"""
category = "mangapanda" category = "mangapanda"
url_base = "http://www.mangapanda.com" url_base = "http://www.mangapanda.com"
class MangaPandaMangaExtractor(MangaPandaBase, MangaReaderMangaExtractor): class MangaPandaMangaExtractor(MangaPandaBase, MangaReaderMangaExtractor):
"""Extract all manga-chapters from mangapanda"""
pattern = [r"(?:https?://)?(?:www\.)?mangapanda\.com(/[^/]+)$"] pattern = [r"(?:https?://)?(?:www\.)?mangapanda\.com(/[^/]+)$"]
class MangaPandaChapterExtractor(MangaPandaBase, MangaReaderChapterExtractor): class MangaPandaChapterExtractor(MangaPandaBase, MangaReaderChapterExtractor):
"""Extract a single manga-chapter from mangapanda"""
pattern = [ pattern = [
r"(?:https?://)?(?:www\.)?mangapanda\.com((/[^/]+)/(\d+))", r"(?:https?://)?(?:www\.)?mangapanda\.com((/[^/]+)/(\d+))",
r"(?:https?://)?(?:www\.)?mangapanda\.com(/\d+-\d+-\d+(/[^/]+)/chapter-(\d+).html)", r"(?:https?://)?(?:www\.)?mangapanda\.com(/\d+-\d+-\d+(/[^/]+)/chapter-(\d+).html)",

View File

@ -6,13 +6,13 @@
# it under the terms of the GNU General Public License version 2 as # it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation. # published by the Free Software Foundation.
"""Extract manga pages from http://www.mangareader.net/""" """Extract manga-chapters and entire manga from http://www.mangareader.net/"""
from .common import AsynchronousExtractor, Extractor, Message from .common import AsynchronousExtractor, Extractor, Message
from .. import text from .. import text
class MangaReaderBase(): class MangaReaderBase():
"""Base class for mangareader extractors"""
category = "mangareader" category = "mangareader"
directory_fmt = ["{category}", "{manga}", "c{chapter:>03} - {title}"] directory_fmt = ["{category}", "{manga}", "c{chapter:>03} - {title}"]
filename_fmt = "{manga}_c{chapter:>03}_{page:>03}.{extension}" filename_fmt = "{manga}_c{chapter:>03}_{page:>03}.{extension}"
@ -20,7 +20,7 @@ class MangaReaderBase():
class MangaReaderMangaExtractor(MangaReaderBase, Extractor): class MangaReaderMangaExtractor(MangaReaderBase, Extractor):
"""Extract all manga-chapters from mangareader"""
pattern = [r"(?:https?://)?(?:www\.)?mangareader\.net(/[^/]+)$"] pattern = [r"(?:https?://)?(?:www\.)?mangareader\.net(/[^/]+)$"]
def __init__(self, match): def __init__(self, match):
@ -38,7 +38,7 @@ class MangaReaderMangaExtractor(MangaReaderBase, Extractor):
class MangaReaderChapterExtractor(MangaReaderBase, AsynchronousExtractor): class MangaReaderChapterExtractor(MangaReaderBase, AsynchronousExtractor):
"""Extract a single manga-chapter from mangareader"""
pattern = [ pattern = [
r"(?:https?://)?(?:www\.)?mangareader\.net((/[^/]+)/(\d+))", r"(?:https?://)?(?:www\.)?mangareader\.net((/[^/]+)/(\d+))",
r"(?:https?://)?(?:www\.)?mangareader\.net(/\d+-\d+-\d+(/[^/]+)/chapter-(\d+).html)", r"(?:https?://)?(?:www\.)?mangareader\.net(/\d+-\d+-\d+(/[^/]+)/chapter-(\d+).html)",