[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}"]
...
pull/3155/head
Allen 2 years ago committed by GitHub
parent bca9f965e5
commit 9fc142d27b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -44,6 +44,10 @@ class MastodonExtractor(BaseExtractor):
del status["media_attachments"] del status["media_attachments"]
status["instance"] = self.instance 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["tags"] = [tag["name"] for tag in status["tags"]]
status["date"] = text.parse_datetime( status["date"] = text.parse_datetime(
status["created_at"][:19], "%Y-%m-%dT%H:%M:%S") status["created_at"][:19], "%Y-%m-%dT%H:%M:%S")

Loading…
Cancel
Save