No description
Find a file
2024-05-09 01:13:10 +02:00
client Download media attachments 2024-05-09 01:13:10 +02:00
files Download media attachments 2024-05-09 01:13:10 +02:00
templates Download media attachments 2024-05-09 01:13:10 +02:00
.gitignore Use flags for query parameters 2024-04-21 19:15:36 +02:00
go.mod Fix paths 2024-04-23 10:31:17 +02:00
go.sum Fix paths 2024-04-23 10:31:17 +02:00
LICENSE Fetch user account id and posts 2024-04-21 15:08:09 +02:00
main.go Fix paths 2024-04-23 10:31:17 +02:00
README.md Update README 2024-04-21 20:11:14 +02:00

Mastodon PESOS

Fetch a Mastodon account's posts and save them as Markdown files. Posts are transformed to Markdown, images are inlined, and replies are threaded. Implements most of the parameters in Mastodon's API to get account's statuses.

For the time being this formats the files with Hugo front-matter.

I use this small tool to create an archive of my Mastodon posts, which I then syndicate to my own site.

Flags

Usage of ./mastodon-pesos:
  -dist string
        Path to directory where files will be written (default "./posts")
  -exclude-reblogs
        Whether or not to exclude reblogs
  -exclude-replies
        Whether or not exclude replies to other users
  -limit int
        Maximum number of posts to fetch (default 40)
  -max-id string
        Fetch posts lesser than this id
  -min-id string
        Fetch posts immediately newer than this id
  -persist
        Persist most recent post id to /tmp/mastodon-pesos-fid
  -since-id string
        Fetch posts greater than this id
  -user string
        URL of User's Mastodon account whose toots will be fetched

Example

Here is how I use this to fetch the 15 most recent posts in my Mastodon account. It excludes replies to others, and reblogs.

Lastly, I use --persist to save the most recent id to a file and use --since-id so that subsequent runs fetch posts only after the most recently fetched post.

./mastodon-pesos \
--user https://social.coop/@ggpsv \
--dist ./posts \
--exclude-replies \
--exclude-reblogs \
--limit=15 \
--persist \
--since-id=$(test -f /tmp/mastodon-pesos-fid && cat /tmp/mastodon-pesos-fid || echo "")