diff --git a/docs/supportedsites.rst b/docs/supportedsites.rst index cf5a62d0..2d5af076 100644 --- a/docs/supportedsites.rst +++ b/docs/supportedsites.rst @@ -49,6 +49,7 @@ Manga Stream https://mangastream.com/ Chapters Mangapanda http://www.mangapanda.com/ Chapters, Manga MangaPark http://mangapark.me/ Chapters, Manga Mangareader http://www.mangareader.net/ Chapters, Manga +Mangazuki https://mangazuki.co/ Chapters nhentai https://nhentai.net/ Galleries Niconico Seiga http://seiga.nicovideo.jp Images from Users, individual Images Required nijie https://nijie.info/ Images from Users, individual Images Required diff --git a/gallery_dl/extractor/__init__.py b/gallery_dl/extractor/__init__.py index 6715472b..f0223b3f 100644 --- a/gallery_dl/extractor/__init__.py +++ b/gallery_dl/extractor/__init__.py @@ -57,6 +57,7 @@ modules = [ "mangapark", "mangareader", "mangastream", + "mangazuki", "nhentai", "nijie", "nyafuu", diff --git a/gallery_dl/extractor/mangazuki.py b/gallery_dl/extractor/mangazuki.py new file mode 100644 index 00000000..3eecfcc5 --- /dev/null +++ b/gallery_dl/extractor/mangazuki.py @@ -0,0 +1,60 @@ +# -*- coding: utf-8 -*- + +# Copyright 2017 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-chapters and entire manga from https://mangazuki.co/""" + +from .common import Extractor, Message +from .. import text, exception + + +class MangazukiChapterExtractor(Extractor): + """Extractor for manga-chapters from mangazuki.co""" + category = "mangazuki" + subcategory = "chapter" + directory_fmt = ["{category}", "{manga}", "c{chapter:>03}"] + filename_fmt = ("{manga}_c{chapter:>03}_{page:>03}.{extension}") + pattern = [r"(?:https?://)?(?:www\.)?(mangazuki\.co/read/[^/]+/\d+)"] + test = [ + ("https://mangazuki.co/read/Double-Casting/59", { + "url": "47b4102da3ee1bd28459848904e8b7ff48e1ac5e", + "keyword": "b4cac50b3a3a1dd06451d1917a0faae2c6a51b95", + }), + ("https://mangazuki.co/read/Double-Casting/999", { + "exception": exception.NotFoundError, + }), + ] + + def __init__(self, match): + Extractor.__init__(self) + self.url = "https://" + match.group(1) + + def items(self): + response = self.request(self.url) + if response.history: + raise exception.NotFoundError("chapter") + page = response.text + data = self.get_metadata(page) + imgs = self.get_images(page) + data["count"] = len(imgs) + + yield Message.Version, 1 + yield Message.Directory, data + for data["page"], url in enumerate(imgs, 1): + yield Message.Url, url, text.nameext_from_url(url, data) + + def get_metadata(self, page): + """Collect metadata for extractor-job""" + return text.extract_all(page, ( + ("manga" , "Mangazuki - ", " - Chapter "), + ("chapter", "", ""), + ), values={"lang": "en", "language": "English"})[0] + + @staticmethod + def get_images(page): + """Return a list of all image-urls""" + return list(text.extract_iter(page, 'data-src="', '"')) diff --git a/test/test_extractors.py b/test/test_extractors.py index 295ea89e..874bb64a 100644 --- a/test/test_extractors.py +++ b/test/test_extractors.py @@ -54,7 +54,7 @@ skip = [ # don't work on travis-ci "exhentai", "kissmanga", "mangafox", "dynastyscans", "nijie", # temporary issues - + "fallenangels", "imgur", ] # enable selective testing for direct calls if __name__ == '__main__' and len(sys.argv) > 1: