1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-22 02:32:33 +01:00

[mangazuki] add chapter extractor

This commit is contained in:
Mike Fährmann 2017-07-19 17:20:03 +02:00
parent 2f2e363c97
commit 1cb1d2e0a3
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
4 changed files with 63 additions and 1 deletions

View File

@ -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

View File

@ -57,6 +57,7 @@ modules = [
"mangapark",
"mangareader",
"mangastream",
"mangazuki",
"nhentai",
"nijie",
"nyafuu",

View File

@ -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" , "<title>Mangazuki - ", " - Chapter "),
("chapter", "", "</title>"),
), 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="', '"'))

View File

@ -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: