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

[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
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
3 changed files with 40 additions and 1 deletions

View File

@ -556,7 +556,7 @@ Consider all listed sites to potentially be NSFW.
<tr>
<td>MangaDex</td>
<td>https://mangadex.org/</td>
<td>Chapters, Followed Feed, Lists, Manga</td>
<td>Authors, Chapters, Followed Feed, Lists, Manga</td>
<td>Supported</td>
</tr>
<tr>

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"]

View File

@ -140,4 +140,22 @@ __tests__ = (
),
},
{
"#url" : "https://mangadex.org/author/7222d0d5-836c-4bf3-9174-72bceade8c87/kotoyama",
"#class" : mangadex.MangadexAuthorExtractor,
"#urls" : (
"https://mangadex.org/title/f48bbb5f-8a23-4dea-8177-eb2dbbcbf4fa",
"https://mangadex.org/title/00b68132-4e69-4ff9-ad4b-29138b377dc8",
"https://mangadex.org/title/41cd6fa7-3e53-4900-88e6-4a06cd7df9ad",
"https://mangadex.org/title/f1b70bba-3873-4c22-afa3-1d1c78299cd9",
"https://mangadex.org/title/259dfd8a-f06a-4825-8fa6-a2dcd7274230",
"https://mangadex.org/title/d0c88e3b-ea64-4e07-9841-c1d2ac982f4a",
),
"id": "7222d0d5-836c-4bf3-9174-72bceade8c87",
"type": "author",
"attributes": dict,
"relationships": list,
},
)