[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}"]
...
This commit is contained in:
Allen
2022-11-02 17:09:38 +01:00
committed by GitHub
parent bca9f965e5
commit 9fc142d27b

View File

@@ -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")