Migrating follows to Mastodon from X and Bluesky
/ 2 min read
Table of Contents
I had bad luck with an earlier Mastodon account that got deleted a while ago, but I’m giving it another go at indieweb.social/@walterra. To help me find my Bluesky and X/Twitter follows I create two small CLI tools.
x2masto — from X/Twitter to Mastodon
x2masto is a Node.js CLI that helps you collect your X following list and extract likely Mastodon handles from profile bios and links. It works in three steps:
- Collect — the script connects to your Chrome browser and opens your
/followingpage. You scroll through the list yourself at your own pace while the script passively reads whatever profile cards are visible on screen — like a clipboard that remembers what you’ve seen. Press Enter in CLI when you’re done. - Match — parse the collected bios and links for
@user@instancepatterns, optionally verify via WebFinger - Search — run a second pass querying Mastodon instance search APIs to catch people who didn’t put their handle in their bio
The collect step deliberately doesn’t automate scrolling or any interaction with the X interface. You browse manually; the script just takes notes. The output is a mastodon-import.csv ready for Mastodon’s built-in import feature.
Install globally with npm install -g x2masto or run it from source.
bsky2masto — from Bluesky to Mastodon
bsky2masto does the same thing but for Bluesky. It’s written in Python and uses the public Bluesky API — no browser needed. It also supports Bridgy Fed opt-in detection, so it can find Bluesky accounts that are already bridged to the fediverse via @handle@bsky.brid.gy.
bsky2masto \ --actor your-handle.bsky.social \ --include-bridgy \ --verifyAvailable via pipx install bsky2masto or uvx bsky2masto for one-shot usage.
Why two separate tools?
X and Bluesky have very different data access stories. X killed its free API in 2023 and offers no way to export your own follow graph, so x2masto takes the approach of a browser helper — you do the browsing, it does the note-taking. Bluesky’s API is public and straightforward, so bsky2masto is a clean Python CLI with no browser involved.
Different problems, different constraints, different languages. Keeping them separate felt right.
The usual caveats
Handle extraction is heuristic. People format their Mastodon handles in all sorts of creative ways in their bios, and some strings that look like handles aren’t. Both tools generate a detailed matches file alongside the import CSV so you can review what they found before importing. I’d recommend a quick scan before hitting upload.
Both projects are MIT licensed and up on GitHub