From a1f5b7803968b1cd0bc221c0cbfb0dff78d382f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Tue, 6 Jul 2021 23:13:58 +0200 Subject: [PATCH] [mastodon] add 'reblogs' option (#1669) --- docs/configuration.rst | 10 ++++++++++ gallery_dl/extractor/mastodon.py | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/docs/configuration.rst b/docs/configuration.rst index 42c45485..5b29d967 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -1269,6 +1269,16 @@ Description Provide ``artist``, ``author``, and ``group`` metadata fields. +extractor.mastodon.reblogs +-------------------------- +Type + ``bool`` +Default + ``false`` +Description + Extract media from reblogged posts. + + extractor.mastodon.text-posts ----------------------------- Type diff --git a/gallery_dl/extractor/mastodon.py b/gallery_dl/extractor/mastodon.py index 9785fc6e..d9aaafc4 100644 --- a/gallery_dl/extractor/mastodon.py +++ b/gallery_dl/extractor/mastodon.py @@ -27,7 +27,13 @@ class MastodonExtractor(BaseExtractor): self.item = match.group(match.lastindex) def items(self): + reblogs = self.config("reblogs", False) + for status in self.statuses(): + if not reblogs and status["reblog"]: + self.log.debug("Skipping %s (reblog)", status["id"]) + continue + attachments = status["media_attachments"] del status["media_attachments"]