Skip to content

Commit

Permalink
[puremashiro] add chapter- and manga-extractor (closes #66)
Browse files Browse the repository at this point in the history
Also adds support for region subtags in language codes (e.g. en-us)
  • Loading branch information
mikf committed Jan 7, 2018
1 parent 974e73b commit 5b09432
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 5 deletions.
1 change: 1 addition & 0 deletions docs/supportedsites.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ Pawoo https://pawoo.net Images from Users, Imag
Pinterest https://www.pinterest.com Boards, Pins, pin.it Links
Pixiv https://www.pixiv.net/ |Images from Use-3| Required
PowerManga https://powermanga.org/ Chapters, Manga
Pure Mashiro http://reader.puremashiro.moe/ Chapters, Manga
Read Comic Online http://readcomiconline.to/ Comic-Issues, Comics
RebeccaBlackTech https://rbt.asia/ Threads
Reddit https://reddit.com/ Submissions, Subreddits Optional (OAuth)
Expand Down
3 changes: 2 additions & 1 deletion gallery_dl/extractor/__init__.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -63,6 +63,7 @@
"pinterest",
"pixiv",
"powermanga",
"puremashiro",
"readcomiconline",
"rebeccablacktech",
"reddit",
Expand Down
9 changes: 5 additions & 4 deletions gallery_dl/extractor/foolslide.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -16,7 +16,7 @@

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+))?)"
Expand Down Expand Up @@ -47,8 +47,9 @@ def request(self, url):
@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 ""
Expand Down
34 changes: 34 additions & 0 deletions gallery_dl/extractor/puremashiro.py
Original file line number Diff line number Diff line change
@@ -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"
1 change: 1 addition & 0 deletions scripts/build_supportedsites.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"nijie" : "nijie",
"nyafuu" : "Nyafuu Archive",
"powermanga" : "PowerManga",
"puremashiro" : "Pure Mashiro",
"readcomiconline": "Read Comic Online",
"rbt" : "RebeccaBlackTech",
"rule34" : "Rule 34",
Expand Down

0 comments on commit 5b09432

Please sign in to comment.