I made a little thing to more easily move to another instance:

A way to quickly grab a list of your subscribed communities.

Go to your list of subscribed communities, <yourinstance>/communities/listing_type/Subscribed/page/1 and create a bookmark with the following code as link:

code
javascript:(function() {
    const currentHostname = window.location.hostname;
    const table = document.getElementById('community_table');
    const anchorTags = table.getElementsByTagName('a');
    const communityUrls = [];

    for (let i = 0; i < anchorTags.length; i++) {
      const title = anchorTags[i].title.substring(1);
      const parts = title.split('@');
      const community = parts[0].trim();
      const domain = parts[1] ? parts[1].trim() : currentHostname;
      const communityUrl = `https://${domain}/c/${community}`;
      communityUrls.push(communityUrl);
    }

    const urlsText = communityUrls.join('\n');

    navigator.clipboard.writeText(urlsText)
      .then(() => {
        alert('Community URLs copied to clipboard!');
      })
      .catch((error) => {
        alert('Failed to copy Community URLs to clipboard:', error);
      });
})();

Clicking this bookmark will automatically copy a list of all your subscribed communities and format the links so that you can pop them in the search bar of another instance to subscribe to them from another account.

It can only scrape what’s on screen, so if your subscribed communities list is several pages long just click the bookmark for each page.

5 points

I made a slight modification to your bookmarklet asking to which instance you are migrating, which produces a list of links you can paste into something like https://www.openallurls.com so it becomes just a matter of clicking all of the “Subscribe” buttons:

javascript:(function() {
  const currentHostname = window.location.hostname;
  const tld = prompt("Please enter the name of the instance to which you are migrating:");
  const table = document.getElementById('community_table');
  const anchorTags = table.getElementsByTagName('a');
  const communityUrls = [];

  for (let i = 0; i < anchorTags.length; i++) {
    const title = anchorTags[i].title.substring(1);
    const parts = title.split('@');
    const community = parts[0].trim();
    const domain = parts[1] ? parts[1].trim() : currentHostname;
    const communityUrl = `https://${tld}/c/${community}@${domain}`;
    communityUrls.push(communityUrl);
  }

  const urlsText = communityUrls.join('\n');

  navigator.clipboard.writeText(urlsText)
    .then(() => {
      alert('Community URLs copied to clipboard!');
    })
    .catch((error) => {
      alert('Failed to copy Community URLs to clipboard:', error);
    });
})();
permalink
report
reply
1 point

Does it cause issues if domain and tld match?

permalink
report
parent
reply
3 points
*

Oh wow that’s cool. In case anyone is looking to spread out and take load off of the most popular instances, we made a new instance on a very robust server at Lemmy.pro - registration is open to come try it out :-)

permalink
report
reply
1 point

Great collection of articles!

permalink
report
parent
reply
1 point

You might also want to check out this Python script which syncs profiles, communities, and blocks between multiple Lemmy accounts.

permalink
report
reply
1 point

You’re awesome! Gonna save this just in case.

permalink
report
reply
1 point

I don’t have a script to automatically subscribe to a list of communities on a new account yet, that’s a bit more difficult…

permalink
report
parent
reply
2 points

Here’s a script to do that: https://github.com/rc9000/lemmy-community-copy

permalink
report
parent
reply

sh.itjust.works Main Community

!main@sh.itjust.works

Create post

Home of the sh.itjust.works instance.

Community stats

  • 868

    Monthly active users

  • 433

    Posts

  • 11K

    Comments