Skip to content

Commit

Permalink
[mastodon] add "remote_instance" field (#3119)
Browse files Browse the repository at this point in the history
Example Usage:
If the url is "mastodon:https://mastodon.example.org/@[email protected] the "remote_instance" will be "botsin.space"
...
"directory": ["mastodon", "{remote_instance|instance}", "{account[username]!l}"]
...
  • Loading branch information
allendema authored Nov 2, 2022
1 parent bca9f96 commit 9fc142d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions gallery_dl/extractor/mastodon.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ def items(self):
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")
Expand Down

0 comments on commit 9fc142d

Please sign in to comment.