From 9fc142d27b94d4742c89a77ca11dcacc61664a79 Mon Sep 17 00:00:00 2001 From: Allen <64094914+allendema@users.noreply.github.com> Date: Wed, 2 Nov 2022 17:09:38 +0100 Subject: [PATCH] [mastodon] add "remote_instance" field (#3119) Example Usage: If the url is "mastodon:https://mastodon.example.org/@VoteChess@botsin.space the "remote_instance" will be "botsin.space" ... "directory": ["mastodon", "{remote_instance|instance}", "{account[username]!l}"] ... --- gallery_dl/extractor/mastodon.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gallery_dl/extractor/mastodon.py b/gallery_dl/extractor/mastodon.py index 0d2cded5..049e0afb 100644 --- a/gallery_dl/extractor/mastodon.py +++ b/gallery_dl/extractor/mastodon.py @@ -44,6 +44,10 @@ class MastodonExtractor(BaseExtractor): del status["media_attachments"] status["instance"] = self.instance + acct = status["account"]["acct"] + status["instance_remote"] = \ + acct.rpartition("@")[2] if "@" in acct else None + status["tags"] = [tag["name"] for tag in status["tags"]] status["date"] = text.parse_datetime( status["created_at"][:19], "%Y-%m-%dT%H:%M:%S")