A collection of useful Mastodon Tools written in Python

By Terence Eden (@edent)

Requires Mastodon.py 1.8.0 or newer.


On This Day

This service shows all the posts you made on this day in previous years.

Read The Blog Post

Usage:

python3 on_this_day.py
Download on_this_day.py

Thread Viewer

This lets you visualise a conversation tree. Give it the URL of any post on your instance and it will get all the replies to it.

Read The Blog Post

⚠️ Note! Large conversations may take a long time to retrieve from the API.

Usage:

python3 threads.py https://your_mastodon.instance/@username@their.instance/1234
Download threads.py
Take a look at the output:
2022-11-04 08:18 Edent: Hello gang! I need your help.Could you please visit the following URl: https://xn--soh.ga/Then send me a screenshot of what your browser's address bar shows. I want to know if it displays as ⏻ or punycode.Thanks! Boosts appreciated. https://mastodon.social/users/Edent/statuses/109284549668003572
	├── 2022-11-04 08:20 gustav: @Edent https://mastodon.se/users/gustav/statuses/109284559207603673
	│   └── 2022-11-04 08:20 Edent: @gustav thanks - which browser / OS is that? https://mastodon.social/users/Edent/statuses/109284560662245988
	│       └── 2022-11-04 08:22 gustav: @Edent Windows 10 Version 21H2, Vivaldi 5.5.2805.42 https://mastodon.se/users/gustav/statuses/109284565710881716
	├── 2022-11-04 08:20 proactivepaul: @Edent Firefox 88.0.1 desktop on Win10 shows me . . . https://mastodon.social/users/proactivepaul/statuses/109284558072260287
	├── 2022-11-04 08:23 Edent: I also wonder whether Mastodon links this URl:https://⏻.ga/ Does that render as a clickable link in your client? https://mastodon.social/users/Edent/statuses/109284568835291682
	│   ├── 2022-11-04 08:23 jack: @Edent non-clickable in Pinafore for me https://mastodon.allnutt.net/users/jack/statuses/109284571328910746
	│   ├── 2022-11-04 08:23 proactivepaul: @Edent not clickable https://mastodon.social/users/proactivepaul/statuses/109284570250516551
	│   │   └── 2022-11-04 08:25 proactivepaul: @Edent and this is what I actually see in Mastodon https://mastodon.social/users/proactivepaul/statuses/109284579945600514
	│   ├── 2022-11-04 08:24 sendung: @Edent In the Mastodon v4.0.0rc1 web UI: yes. But I guess you knew that already. https://mastodon.social/users/sendung/statuses/109284574226105708
	│   ├── 2022-11-04 08:25 gustav: @Edent didn't pretty much all browsers stop showing any special characters (basically anything not in a-z) to stop Unicode Domain Phishing?https://www.xudongz.com/blog/2017/idn-phishing/ https://mastodon.se/users/gustav/statuses/109284579180019317
	│   │   └── 2022-11-04 08:27 Edent: @gustav No. Apple's browser shows the correct symbol. https://mastodon.social/users/Edent/statuses/109284585094112010
	│   │       └── 2022-11-04 08:27 gustav: @Edent interesting https://mastodon.se/users/gustav/statuses/109284586900219669
	│   ├── 2022-11-04 08:25 marxjohnson: @Edent Um, no (Tusky on Android 10) https://octodon.social/users/marxjohnson/statuses/109284579810534821
	│   ├── 2022-11-04 08:25 public: @Edent this one is unclickable. the first one just shows the punycode in Chrome Android 107 https://mastodon.online/users/public/statuses/109284577473786203
	

Status Info

Pretty Prints (in colour!) all the data behind a status.

Usage:

python3 status.py https://mastodon.social/@Edent/109358520333182101
Download status.py
Take a look at the output:
{
│   'id': 109284549668003572,
│   'created_at': datetime.datetime(2022, 11, 4, 8, 18, 11, 375000, tzinfo=tzutc()),
│   'in_reply_to_id': None,
│   'in_reply_to_account_id': None,
│   'sensitive': False,
│   'spoiler_text': '',
│   'visibility': 'public',
│   'language': 'en',
│   'uri': 'https://mastodon.social/users/Edent/statuses/109284549668003572',
│   'url': 'https://mastodon.social/@Edent/109284549668003572',
│   'replies_count': 24,
│   'reblogs_count': 7,
│   'favourites_count': 0,
│   'edited_at': None,
│   'favourited': False,
│   'reblogged': False,
│   'muted': False,
│   'bookmarked': False,
│   'pinned': False,
│   'content': '<p>Hello gang! I need your help.</p><p>Could you please visit the following URl: <a href="https://xn--soh.ga/" target="_blank" rel="nofollow noopener noreferrer"><span class="invisible">https://</span><span class="">xn--soh.ga/</span><span class="invisible"></span></a></p><p>Then send me a screenshot of what your browser&#39;s address bar shows. I want to know if it displays as ⏻ or punycode.</p><p>Thanks! Boosts appreciated.</p>',
│   'filtered': [],
│   'reblog': None,
│   'application': {'name': 'Web', 'website': None},
│   'account': {
│   │   'id': 7112,
│   │   'username': 'Edent',
│   │   'acct': 'Edent',
│   │   'display_name': 'Terence Eden',
│   │   'locked': False,
│   │   'bot': False,
│   │   'discoverable': True,
│   │   'group': False,
│   │   'created_at': datetime.datetime(2016, 11, 1, 0, 0, tzinfo=tzutc()),
│   │   'note': '<p>Longer hair than you.<br />Work in <a href="https://mastodon.social/tags/CyberSecurity" class="mention hashtag" rel="tag">#<span>CyberSecurity</span></a>.<br />Got the ⏻ symbol into <a href="https://mastodon.social/tags/Unicode" class="mention hashtag" rel="tag">#<span>Unicode</span></a>.<br />Open Standards / Source / Data geek.<br />Known as <span class="h-card"><a href="https://mastodon.social/@Edent" class="u-url mention">@<span>Edent</span></a></span> on most social platforms.<br />Studying for an MSc in using the Metaverse for analytics.<br />Bit obsessed with <a href="https://mastodon.social/tags/SolarPower" class="mention hashtag" rel="tag">#<span>SolarPower</span></a> but not quite a <a href="https://mastodon.social/tags/SolarPunk" class="mention hashtag" rel="tag">#<span>SolarPunk</span></a>.</p>',
│   │   'url': 'https://mastodon.social/@Edent',
│   │   'avatar': 'https://files.mastodon.social/accounts/avatars/000/007/112/original/29984722263_ade8a25ec5_k.jpg',
│   │   'avatar_static': 'https://files.mastodon.social/accounts/avatars/000/007/112/original/29984722263_ade8a25ec5_k.jpg',
│   │   'header': 'https://files.mastodon.social/accounts/headers/000/007/112/original/9982f60fe9e60550.jpeg',
│   │   'header_static': 'https://files.mastodon.social/accounts/headers/000/007/112/original/9982f60fe9e60550.jpeg',
│   │   'followers_count': 3409,
│   │   'following_count': 513,
│   │   'statuses_count': 4289,
│   │   'last_status_at': datetime.datetime(2022, 12, 4, 0, 0),
│   │   'noindex': False,
│   │   'emojis': [],
│   │   'fields': [
│   │   │   {'name': 'Location', 'value': 'London, UK', 'verified_at': None},
│   │   │   {
│   │   │   │   'name': 'Contact',
│   │   │   │   'value': '<a href="https://edent.tel/" target="_blank" rel="nofollow noopener noreferrer me"><span class="invisible">https://</span><span class="">edent.tel/</span><span class="invisible"></span></a>',
│   │   │   │   'verified_at': '2022-05-04T16:47:47.550+00:00'
│   │   │   },
│   │   │   {
│   │   │   │   'name': 'Blog',
│   │   │   │   'value': '<a href="https://shkspr.mobi/blog" target="_blank" rel="nofollow noopener noreferrer me"><span class="invisible">https://</span><span class="">shkspr.mobi/blog</span><span class="invisible"></span></a>',
│   │   │   │   'verified_at': '2022-05-04T16:51:16.145+00:00'
│   │   │   },
│   │   │   {'name': 'Pronouns', 'value': 'He/Him/♂/男', 'verified_at': None}
│   │   ]
},
│   'media_attachments': [],
│   'mentions': [],
│   'tags': [],
│   'emojis': [],
│   'card': None,
│   'poll': None
}