Toots migration

#1

Hello there,
I’m going to switch from a shared instance to a mono-user instance. I wanted to know if it is a good or a bad idea to import my toots from the exported outbox.json.
I looked at the database and my plan consist in:

  1. Insert the toots that aren’t part of any conversation into the statutes table
  2. Create or get the tags from these toots and insert the related information into the statutes_tags and tags tables

I don’t want these toots to be published to the fediverse again, I just don’t want to start with an empty profile.
Would I get any trouble with my profile doing such a thing? It seems so easy that I have the feeling of missing something obvious…
Have a nice day and thanks for your help.

0 Likes

#2

That sounds okay if you know how to do that but it’s not entirely trivial to do. Some challenges: outbox.json has HTML in the toots (so it’s not dependent on Mastodon syntax for formatting), but when creating local toots, HTML won’t work (will be considered unsafe), so you need to convert the HTML back to plaintext. Media attachments are included in the archive, but you’ll have to copy the files and create media_attachments to connect them to the toots.

It’s really unfortunate that we don’t yet have an import tool for the archives that we export at least as an admin or tootctl feature. The main reason why it’s not generally available is that processing an archive for a single user is too much work and cannot not impact everyone on the server, but for your use case that doesn’t matter and it should really be something that exists.

1 Like

#3

Thanks for your reply. I’m lucky enough not having any attachment.

About the HTML cleaning, I might be wrong but I can see HTML into the text field on posts from other sources than Mastodon.

Another interrogation I have is about the id field. The one included into the outbox.json is the toot URL. Is it safe to extract the id from it?
The id from https://mastodon.social/users/Simounet/statuses/101856470865577071/activity could be 101856470865577071.

0 Likes

#4

Hi,
I achieved my goal migrating my toots from a multi-users instance to a mono one and it seems to be working as far as I know. I made a little tool to help other people interested in this kind of process. It’s not handy but I think it is manageable. You can find it here: Simounet / Mastodon Toots Migration Queries Generator · GitLab .

1 Like