Do you want to download your toots from Mastodon and analyze them with your own program?

Here’s a tip from one programmer to another: use this endpoint instead of studying the Mastodon API (which can do much more).

https://<mastodon_instance_url>/<@username>.rss?limit=<number_of_toots_you_want>

The endpoint will return an RSS file with your latest posts.

Here’s a practical example in python to download my toots, using the excellent libraries feedparser and requests.

# Remember to install requests and feedparser
# using the pip command before using this code!

import requests
import feedparser


request = requests.get("https://livellosegreto.it/@cesco.rss?limit=3")
feed = feedparser.parse(request.text)
for article in feed.entries:
    print(article["summary"], end=f"\n{'='*60}\n")