diff options
Diffstat (limited to 'gallery_dl/extractor/pixiv.py')
| -rw-r--r-- | gallery_dl/extractor/pixiv.py | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/gallery_dl/extractor/pixiv.py b/gallery_dl/extractor/pixiv.py index 8aee058..a872ada 100644 --- a/gallery_dl/extractor/pixiv.py +++ b/gallery_dl/extractor/pixiv.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright 2014-2020 Mike Fährmann +# Copyright 2014-2021 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 @@ -217,6 +217,12 @@ class PixivWorkExtractor(PixivExtractor): "url": "7267695a985c4db8759bebcf8d21dbdd2d2317ef", "keywords": {"frames": list}, }), + # related works (#1237) + ("https://www.pixiv.net/artworks/966412", { + "options": (("related", True),), + "range": "1-10", + "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 +239,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 +584,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} |
