diff --git a/docs/configuration.rst b/docs/configuration.rst index 51bdd4f0..ca6d6485 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -3520,6 +3520,17 @@ Description Note: This requires 1 additional API request per bookmarked post. +extractor.pixiv.captions +------------------------ +Type + ``bool`` +Default + ``false`` +Description + For works with seemingly empty ``caption`` metadata, + try to grab the actual ``caption`` value using the AJAX API. + + extractor.pixiv.comments ------------------------ Type diff --git a/gallery_dl/extractor/pixiv.py b/gallery_dl/extractor/pixiv.py index 49fbeee2..ab8c5979 100644 --- a/gallery_dl/extractor/pixiv.py +++ b/gallery_dl/extractor/pixiv.py @@ -38,6 +38,7 @@ class PixivExtractor(Extractor): self.meta_user = self.config("metadata") self.meta_bookmark = self.config("metadata-bookmark") self.meta_comments = self.config("comments") + self.meta_captions = self.config("captions") def items(self): tags = self.config("tags", "japanese") @@ -76,7 +77,7 @@ class PixivExtractor(Extractor): detail = self.api.illust_bookmark_detail(work["id"]) work["tags_bookmark"] = [tag["name"] for tag in detail["tags"] if tag["is_registered"]] - if self.sanity_workaround and not work.get("caption") and \ + if self.meta_captions and not work.get("caption") and \ not work.get("_mypixiv") and not work.get("_ajax"): body = self._request_ajax("/illust/" + str(work["id"])) if body: @@ -294,9 +295,6 @@ class PixivExtractor(Extractor): "x_restrict" : 0, } - def _web_to_mobile(self, work): - return work - def works(self): """Return an iterable containing all relevant 'work' objects""" diff --git a/test/results/pixiv.py b/test/results/pixiv.py index f06e7eab..d26ce55c 100644 --- a/test/results/pixiv.py +++ b/test/results/pixiv.py @@ -277,6 +277,7 @@ __tests__ = ( "#url" : "https://www.pixiv.net/en/artworks/103983466", "#comment" : "empty 'caption' in App API response (#4327, #5191)", "#class" : pixiv.PixivWorkExtractor, + "#options" : {"captions": True}, "caption": r"re:Either she doesn't know how to pose or she can't move with that much clothing on her, in any case she's very well dressed for a holiday trip around town. Lots of stuff to see and a perfect day to grab some sweet pastries at the bakery.
...", },