diff --git a/gallery_dl/extractor/pixiv.py b/gallery_dl/extractor/pixiv.py index 76bb08ddb1..8ad061d45f 100644 --- a/gallery_dl/extractor/pixiv.py +++ b/gallery_dl/extractor/pixiv.py @@ -606,7 +606,10 @@ def __init__(self, match): self.mode = self.date = None def works(self): - return self.api.illust_ranking(self.mode, self.date) + ranking = self.ranking + for ranking["rank"], work in enumerate( + self.api.illust_ranking(self.mode, self.date), 1): + yield work def metadata(self): query = text.parse_query(self.query) @@ -645,10 +648,12 @@ def metadata(self): date = (now - timedelta(days=1)).strftime("%Y-%m-%d") self.date = date - return {"ranking": { + self.ranking = ranking = { "mode": mode, "date": self.date, - }} + "rank": 0, + } + return {"ranking": ranking} class PixivSearchExtractor(PixivExtractor): diff --git a/test/results/pixiv.py b/test/results/pixiv.py index d3f5bde496..c4ebc94fb6 100644 --- a/test/results/pixiv.py +++ b/test/results/pixiv.py @@ -445,6 +445,13 @@ "#url" : "https://www.pixiv.net/ranking.php", "#category": ("", "pixiv", "ranking"), "#class" : pixiv.PixivRankingExtractor, + "#options" : {"max-posts": 10}, + + "ranking": { + "date": r"re:\d\d\d\d-\d\d-\d\d", + "mode": "day", + "rank": range(1, 10), + }, }, {