From 0cf7282fa0379cd4607a06183cd97e6d1fb86387 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Thu, 1 Jun 2023 13:07:20 +0200 Subject: [PATCH] [pixiv] add 'full-series' option for novels (#4111) --- docs/configuration.rst | 11 +++++++++++ gallery_dl/extractor/pixiv.py | 11 ++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/docs/configuration.rst b/docs/configuration.rst index 024bf481..f8bd38b8 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -2436,6 +2436,17 @@ Description Download images embedded in novels. +extractor.pixiv.novel.full-series +--------------------------------- +Type + ``bool`` +Default + ``false`` +Description + When downloading a novel being part of a series, + download all novels of that series. + + extractor.pixiv.metadata ------------------------ Type diff --git a/gallery_dl/extractor/pixiv.py b/gallery_dl/extractor/pixiv.py index 6781a331..1fc739c7 100644 --- a/gallery_dl/extractor/pixiv.py +++ b/gallery_dl/extractor/pixiv.py @@ -796,6 +796,11 @@ class PixivNovelExtractor(PixivExtractor): "options": (("embeds", True),), "count": 3, }), + # full series + ("https://www.pixiv.net/novel/show.php?id=19612040", { + "options": (("full-series", True),), + "count": 4, + }), # short URL ("https://www.pixiv.net/n/19612040"), ) @@ -893,7 +898,11 @@ class PixivNovelExtractor(PixivExtractor): yield Message.Queue, url, novel def novels(self): - return (self.api.novel_detail(self.novel_id),) + novel = self.api.novel_detail(self.novel_id) + if self.config("full-series") and novel["series"]: + self.subcategory = PixivNovelSeriesExtractor.subcategory + return self.api.novel_series(novel["series"]["id"]) + return (novel,) class PixivNovelUserExtractor(PixivNovelExtractor):