[mangadex] add 'author' extractor (#6372)

This commit is contained in:
Mike Fährmann
2024-10-24 14:57:17 +02:00
parent c243a7b060
commit 0fd98f67ba
3 changed files with 40 additions and 1 deletions

View File

@@ -174,6 +174,23 @@ class MangadexListExtractor(MangadexExtractor):
yield Message.Queue, url, data
class MangadexAuthorExtractor(MangadexExtractor):
"""Extractor for mangadex authors"""
subcategory = "author"
pattern = BASE_PATTERN + r"/author/([0-9a-f-]+)"
example = ("https://mangadex.org/author"
"/01234567-89ab-cdef-0123-456789abcdef/NAME")
def items(self):
author = self.api.author(self.uuid)
author["_extractor"] = MangadexMangaExtractor
for item in author["relationships"]:
if item["type"] == "manga":
url = "{}/title/{}".format(self.root, item["id"])
yield Message.Queue, url, author
class MangadexAPI():
"""Interface for the MangaDex API v5
@@ -195,6 +212,10 @@ class MangadexAPI():
def athome_server(self, uuid):
return self._call("/at-home/server/" + uuid)
def author(self, uuid, manga=False):
params = {"includes[]": ("manga",)} if manga else None
return self._call("/author/" + uuid, params)["data"]
def chapter(self, uuid):
params = {"includes[]": ("scanlation_group",)}
return self._call("/chapter/" + uuid, params)["data"]