diff --git a/docs/configuration.rst b/docs/configuration.rst index 2cb28981..5988d7be 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -2247,6 +2247,18 @@ Description Fetch media from replies to other notes. +extractor.[moebooru].pool.metadata +---------------------------------- +Type + ``bool`` +Default + ``false`` +Description + Extract extended ``pool`` metadata. + + Note: Not supported by all ``moebooru`` instances. + + extractor.newgrounds.flash -------------------------- Type diff --git a/gallery_dl/extractor/moebooru.py b/gallery_dl/extractor/moebooru.py index 145dd51d..e97d2736 100644 --- a/gallery_dl/extractor/moebooru.py +++ b/gallery_dl/extractor/moebooru.py @@ -124,6 +124,11 @@ class MoebooruPoolExtractor(MoebooruExtractor): self.pool_id = match.group(match.lastindex) def metadata(self): + if self.config("metadata"): + url = "{}/pool/show/{}.json".format(self.root, self.pool_id) + pool = self.request(url).json() + pool.pop("posts", None) + return {"pool": pool} return {"pool": text.parse_int(self.pool_id)} def posts(self): diff --git a/test/results/konachan.py b/test/results/konachan.py index 576acdaa..ed4d2d78 100644 --- a/test/results/konachan.py +++ b/test/results/konachan.py @@ -5,6 +5,7 @@ # published by the Free Software Foundation. from gallery_dl.extractor import moebooru +from gallery_dl import exception __tests__ = ( @@ -54,6 +55,15 @@ __tests__ = ( "#sha1_content": "cf0546e38a93c2c510a478f8744e60687b7a8426", }, +{ + "#url" : "https://konachan.com/pool/show/95", + "#comment" : "'metadata' option (#4646)", + "#category": ("moebooru", "konachan", "pool"), + "#class" : moebooru.MoebooruPoolExtractor, + "#options" : {"metadata": True}, + "#exception": exception.HttpError, +}, + { "#url" : "https://konachan.net/pool/show/95", "#category": ("moebooru", "konachan", "pool"), diff --git a/test/results/yandere.py b/test/results/yandere.py index 3b4d9a96..74194bb4 100644 --- a/test/results/yandere.py +++ b/test/results/yandere.py @@ -62,6 +62,27 @@ __tests__ = ( "#sha1_content": "2a35b9d6edecce11cc2918c6dce4de2198342b68", }, +{ + "#url" : "https://yande.re/pool/show/318", + "#comment" : "'metadata' option (#4646)", + "#category": ("moebooru", "yandere", "pool"), + "#class" : moebooru.MoebooruPoolExtractor, + "#options" : {"metadata": True}, + "#count" : 3, + + "pool": { + "created_at" : "2008-12-13T15:56:10.728Z", + "description": "Dengeki Hime's posts are in pool #97.", + "id" : 318, + "is_public" : True, + "name" : "Galgame_Mag_08", + "post_count" : 3, + "updated_at" : "2012-03-11T14:31:00.935Z", + "user_id" : 1305, + }, + +}, + { "#url" : "https://yande.re/post/popular_by_month?month=6&year=2014", "#category": ("moebooru", "yandere", "popular"),