Skip to content

Commit

Permalink
[mastodon] add "remote_instance" field
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 Oct 29, 2022
1 parent f81dd52 commit 3800491
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions gallery_dl/extractor/mastodon.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ def items(self):
del status["media_attachments"]

status["instance"] = self.instance
if "@" in status["account"]["acct"]:
status["remote_instance"] = status["account"]["acct"].split('@')[1]
else:
status["remote_instance"] = 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 3800491

Please sign in to comment.