[mangadex] handle manga pages without chapters

This commit is contained in:
Mike Fährmann
2019-01-03 11:52:00 +01:00
parent 0afa913de4
commit a303efb597

View File

@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright 2018 Mike Fährmann # Copyright 2018-2019 Mike Fährmann
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License version 2 as
@@ -114,7 +114,7 @@ class MangadexMangaExtractor(MangadexExtractor):
r"/(?:title|manga)/(\d+)"] r"/(?:title|manga)/(\d+)"]
test = [ test = [
("https://mangadex.org/manga/2946/souten-no-koumori", { ("https://mangadex.org/manga/2946/souten-no-koumori", {
"count": ">= 1", "pattern": r"https://mangadex.org/chapter/\d+",
"keywords": { "keywords": {
"manga": "Souten no Koumori", "manga": "Souten no Koumori",
"manga_id": 2946, "manga_id": 2946,
@@ -132,6 +132,9 @@ class MangadexMangaExtractor(MangadexExtractor):
("https://mangadex.org/manga/13318/dagashi-kashi/chapters/2/", { ("https://mangadex.org/manga/13318/dagashi-kashi/chapters/2/", {
"count": ">= 100", "count": ">= 100",
}), }),
("https://mangadex.org/title/13004/yorumori-no-kuni-no-sora-ni", {
"count": 0,
}),
("https://mangadex.org/title/2946/souten-no-koumori", None), ("https://mangadex.org/title/2946/souten-no-koumori", None),
] ]
@@ -148,6 +151,8 @@ class MangadexMangaExtractor(MangadexExtractor):
def chapters(self): def chapters(self):
"""Return a sorted list of chapter-metadata dicts""" """Return a sorted list of chapter-metadata dicts"""
data = self.manga_data(self.manga_id) data = self.manga_data(self.manga_id)
if "chapter" not in data:
return ()
manga = data["manga"] manga = data["manga"]
results = [] results = []