mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-22 10:42:34 +01:00
[pixiv] add 'related' option (#1237)
This commit is contained in:
parent
e9a75e27d9
commit
c008cb5100
@ -1230,6 +1230,16 @@ Description
|
||||
Download user avatars.
|
||||
|
||||
|
||||
extractor.pixiv.work.related
|
||||
----------------------------
|
||||
Type
|
||||
``bool``
|
||||
Default
|
||||
``false``
|
||||
Description
|
||||
Also download related artworks.
|
||||
|
||||
|
||||
extractor.pixiv.ugoira
|
||||
----------------------
|
||||
Type
|
||||
|
@ -217,6 +217,11 @@ class PixivWorkExtractor(PixivExtractor):
|
||||
"url": "7267695a985c4db8759bebcf8d21dbdd2d2317ef",
|
||||
"keywords": {"frames": list},
|
||||
}),
|
||||
# related works (#1237)
|
||||
("https://www.pixiv.net/artworks/966412", {
|
||||
"options": (("related", True),),
|
||||
"count": ">= 10",
|
||||
}),
|
||||
("https://www.pixiv.net/en/artworks/966412"),
|
||||
("http://www.pixiv.net/member_illust.php?mode=medium&illust_id=96641"),
|
||||
("http://i1.pixiv.net/c/600x600/img-master"
|
||||
@ -233,7 +238,11 @@ class PixivWorkExtractor(PixivExtractor):
|
||||
self.illust_id = match.group(1) or match.group(2)
|
||||
|
||||
def works(self):
|
||||
return (self.api.illust_detail(self.illust_id),)
|
||||
works = (self.api.illust_detail(self.illust_id),)
|
||||
if self.config("related", False):
|
||||
related = self.api.illust_related(self.illust_id)
|
||||
works = itertools.chain(works, related)
|
||||
return works
|
||||
|
||||
|
||||
class PixivFavoriteExtractor(PixivExtractor):
|
||||
@ -574,6 +583,10 @@ class PixivAppAPI():
|
||||
params = {"mode": mode, "date": date}
|
||||
return self._pagination("v1/illust/ranking", params)
|
||||
|
||||
def illust_related(self, illust_id):
|
||||
params = {"illust_id": illust_id}
|
||||
return self._pagination("v2/illust/related", params)
|
||||
|
||||
def search_illust(self, word, sort=None, target=None, duration=None):
|
||||
params = {"word": word, "search_target": target,
|
||||
"sort": sort, "duration": duration}
|
||||
|
Loading…
Reference in New Issue
Block a user