From 79dce8ae689815789b225a1f518109c4a3883bee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Fri, 20 May 2022 22:32:35 +0200 Subject: [PATCH] [weasyl] implement 'metadata' option (#2610) --- docs/configuration.rst | 14 ++++++++++++++ docs/gallery-dl.conf | 3 ++- gallery_dl/extractor/weasyl.py | 4 ++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/docs/configuration.rst b/docs/configuration.rst index 453ee5ac..b844a4ec 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -2435,6 +2435,20 @@ Description to use your account's browsing settings and filters. +extractor.weasyl.metadata +------------------------- +Type + ``bool`` +Default + ``false`` +Description + | Fetch extra submission metadata during gallery downloads. + | (``comments``, ``description``, ``favorites``, ``folder_name``, + ``tags``, ``views``) + + Note: This requires 1 additional HTTP request per submission. + + extractor.weibo.retweets ------------------------ Type diff --git a/docs/gallery-dl.conf b/docs/gallery-dl.conf index 58fdbdb4..ba4fe2be 100644 --- a/docs/gallery-dl.conf +++ b/docs/gallery-dl.conf @@ -296,7 +296,8 @@ }, "weasyl": { - "api-key": null + "api-key": null, + "metadata": false }, "weibo": { diff --git a/gallery_dl/extractor/weasyl.py b/gallery_dl/extractor/weasyl.py index 75b78c58..599a175e 100644 --- a/gallery_dl/extractor/weasyl.py +++ b/gallery_dl/extractor/weasyl.py @@ -47,6 +47,7 @@ class WeasylExtractor(Extractor): return data def submissions(self, owner_login, folderid=None): + metadata = self.config("metadata") url = "{}/api/users/{}/gallery".format(self.root, owner_login) params = { "nextid" : None, @@ -56,6 +57,9 @@ class WeasylExtractor(Extractor): while True: data = self.request(url, params=params).json() for submission in data["submissions"]: + if metadata: + submission = self.request_submission( + submission["submitid"]) if self.populate_submission(submission): submission["folderid"] = folderid # Do any submissions have more than one url? If so