Tidying up.
I wanted to delete an old Mastodon account (and especially nuke those pesky Favourites).
Totally delete.
Avatars, banners, favourites, images, posts, everything.
Removing old posts is a trivial matter now that Mastodon allows for automated post deletions.
You can set the expiry threshold to a week and just wait.
Mastodon Post Deletion Screen
But those ‘Favourites’ remained, and I had thousands of them to delete.
Thousands.
I could have sat there for a couple of hours unclicking all of of those little stars but I wasn’t about to do that.
Using ‘mastodon-archive’ to delete those pesky Favourites
Thankfully I came across ‘ mastodon-archive ‘ which says it:
“allows you to make an archive of your statuses, your favourites, bookmarks and the media in both your statuses, your favourites and your bookmarks.”
Additionally there is a process around “Expiring your toots and favourites”, which Mastodon does not do at all.
It comes with a warning, which sounds like it will:
“Warning: This is a destructive operation. You will delete your toots on your instance, or unfavour your favourites, or dismiss your notifications on your instance.”
The full documentation is in the mastodon project and there are a slew of options available, including downloading an archive for offline processing with jq , which is:
“like
sed
for JSON data – you can use it to slice and filter and map and transform structured data with the same ease thatsed
,awk
,grep
and friends let you play with text.”
But I was only interested in destroying things so got straight to work, issuing the below in a terminal:
sudo apt install python3-pip
sudo pip3 install mastodon-archive
I didn’t bother updating my $PATH and ran the command below which will, after an authorisation prompt, create the initial Mastodon archive:
/home/foo/.local/bin/mastodon-archive archive my_unwanted account@mastodon.social
Then, running the below will loop through that Mastodon archive and remove all the posts that have been favourited:
/home/foo/.local/bin/mastodon-archive expire --collection favourites --older-than 0 --confirmed my_unwanted account@mastodon.social
Simple.
The whole process took about 10 minutes to create the initial archive and another 20 to loop through and delete them all.
As is usual with a Linux terminal command, there is no verbose output.
If I had one very minor gripe, it would be to include a -v flag.