The goal of this Ruby script is to parse the Mastodon accounts you follow in search of accounts that: (a) Have moved, and (b) where you don't follow the new ("moved') accounts.
It then asks you if you want to follow each of those "moved" accounts that you don't follow. If user responds "yes", you can follow them!
If you don't already have Ruby installed, you'll have to download it and install an up-to-date version, like 2.5.1. Then you'll need to install a Ruby gem called mastodon-api (you can do this by running gem install mastodon-api
in the terminal from the command line).
Next, download (or copy and paste) the masto_following_updater.rb
file on to to your computer.
Back in the terminal, run ruby masto_following_updater.rb
while in the same directory as the file. You should then be prompted for a couple pieces of information, which I explain a bit below.
In order to check your follows to see if they've moved, this program is going to need some information from you.
-
Your instance's base URL. For example, https://mastodon.social or https://octodon.social
-
An access token from a Mastodon application. To get this, on your Mastodon account, in the web interface, go to Settings > Development and create a new app. Give the app permission to "read all your account data", "see your follows", and "follow people".
-
A spreadsheet of all the accounts you currently follow. To get this, again in the web interface of your Mastodon account, go to Settings > "Data export" and click the "CSV" link next to "You follow". This will download a spreadsheet on to your computer. The program will ask where this local file is stored.
After it gets those three pieces of information, the script should start churning through your follows. It takes some time, but eventually it (may) find some accounts for you to follow or not.
Good luck! If you run into problems, leave a comment here or reach out on Mastodon.
If you have a Ruby gem called "mastodon" and "mastodon-api" installed, you'll get an error. Run gem uninstall mastodon && gem install mastodon-api
and try again.
This is also a bit of a proof of concept for a feature to (ideally) be built into Mastodon as a button in the Setting UI that explains "Find users you've followed that have moved" and then asks if they'd like to follow their new accounts.
Obviously, implementing this at scale in Mastodon's code would be way more difficult than this script.
Note that there are already two Github issues about this: #6955 and, more broadly, #177
If you're looking for a tool to help you move fediverse accounts, check out Migrannounce, a "tool lets you message each of your followers so you can tell them you moved elsewhere."
The MIT License (MIT)
Copyright (c) 2018 Sam Schlinkert
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE