[puremashiro] add chapter- and manga-extractor (closes #66)

Also adds support for region subtags in language codes (e.g. en-us)
This commit is contained in:
Mike Fährmann
2018-01-07 21:42:28 +01:00
parent 974e73bdbb
commit 5b094328b5
5 changed files with 43 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright 2015-2017 Mike Fährmann
# 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
@@ -63,6 +63,7 @@ modules = [
"pinterest",
"pixiv",
"powermanga",
"puremashiro",
"readcomiconline",
"rebeccablacktech",
"reddit",

View File

@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright 2016-2017 Mike Fährmann
# 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
@@ -16,7 +16,7 @@ import json
CHAPTER_RE = (
r"/read/[^/]+"
r"/(?P<lang>[a-z]{2})"
r"/(?P<lang>[a-z-]+)"
r"/(?P<volume>\d+)"
r"/(?P<chapter>\d+)"
r"(?:/(?P<chapter_minor>\d+))?)"
@@ -47,8 +47,9 @@ class FoolslideExtractor(SharedConfigExtractor):
@staticmethod
def parse_chapter_url(url, data):
info = url.partition("/read/")[2].rstrip("/").split("/")
data["lang"] = info[1]
data["language"] = util.code_to_language(info[1])
lang = info[1].partition("-")[0]
data["lang"] = lang
data["language"] = util.code_to_language(lang)
data["volume"] = util.safe_int(info[2])
data["chapter"] = util.safe_int(info[3])
data["chapter_minor"] = "." + info[4] if len(info) >= 5 else ""

View File

@@ -0,0 +1,34 @@
# -*- coding: utf-8 -*-
# Copyright 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.
"""Extractors for http://reader.puremashiro.moe/"""
from . import foolslide
class PuremashiroChapterExtractor(foolslide.FoolslideChapterExtractor):
"""Extractor for manga-chapters from reader.puremashiro.moe"""
category = "puremashiro"
pattern = foolslide.chapter_pattern(r"reader\.puremashiro\.moe")
test = [(("http://reader.puremashiro.moe"
"/read/parallel-paradise-eng/en-us/0/20/"), {
"url": "00d5bc9cbb413ed584ddb091ae2418ca7801b136",
"keyword": "73bba3222758927e5a7cdc9e1db9d8307fe944c0",
})]
scheme = "http"
class PuremashiroMangaExtractor(foolslide.FoolslideMangaExtractor):
"""Extractor for manga from reader.puremashiro.moe"""
category = "puremashiro"
pattern = foolslide.manga_pattern(r"reader\.puremashiro\.moe")
test = [("http://reader.puremashiro.moe/series/hayate-no-gotoku/", {
"url": "0cf77a623bff35b43323427a8fd1e40ff0e13c09",
"keyword": "1b57d724b259a1d81b6352d889a1aa5eb86a6ef9",
})]
scheme = "http"