Mastotool

After a while, you need to be able to back up your Mastodon content, and there is currently no way to get anything except your follow/block/mute lists.

So I whipped out Python and made a kind of brute-force scraper.

Mastotool

Unzip it, make sure you have a recent version of Python installed, install lxml:

% sudo pip3 install lxml

% ./Mastotool.py -help
Usage: Mastotool.py [COMMAND]...\n%s
-m      Mirror media (calls wget)
-b URL      Backup from URL 'http://example.com/@username'
-l FILENAME Load from JSON file
-df FORMAT  Set format for display: text (default), html
-o FILENAME Output display to file instead of stdout
-d      Display all posts
-s FILENAME Save to JSON file

To make a backup:
% ./Mastotool.py -m -b http://example.com/@username -s username.json

To display that backup:
% ./Mastotool.py -l username.json -d

To display HTML:
% ./Mastotool.py -l username.json -df html -o username.html -d

Please only use this on your own data.

Email me or contact me on Mastodon if you have bugs to report or features you want, or fix it yourself.

BSD license, so don’t blame me if it eats your pet iguana.

  • 2017-11-17: Added HTML output, removed a duplicated text node
  • 2017-07-27: Created