Skip to content

Instantly share code, notes, and snippets.

@andrewpomeroy
Last active November 19, 2023 08:45
Show Gist options
  • Save andrewpomeroy/cb76360e773f1cf29b98531a289eebce to your computer and use it in GitHub Desktop.
Save andrewpomeroy/cb76360e773f1cf29b98531a289eebce to your computer and use it in GitHub Desktop.
Automate migration of Twitter -> Bluesky follows, using the Chrome extension Sky Follower Bridge
// 1. Grab the Chrome extension from https://chrome.google.com/webstore/detail/sky-follower-bridge/behhbpbpmailcnfbjagknjngnfdojpko
// 2. Open up the "Following" tab your Twitter profile
// 3. Activate the extension, follow its instructions. You should start seeing "Follow on bluesky" buttons show up on the page next to some of your follows.
// 4. Open up the Chrome console (Cmd+Option+J on Mac, Ctrl+Shift+J on Windows)
// 5. Paste the big ol' code snippet below into the console and hit Enter
// NOTE: You'll need to keep this window upfront and active, so you may need to change your laptop's lock-screen / power settings to make sure it doesn't go to sleep while this process is running
var loop = () => {
const buttons = Array.from(document.querySelectorAll('.action-button:not(.action-button__being):not(.action-button__just-applied)'));
const button = buttons?.[0];
if (button) {
button.scrollIntoView({
behavior: 'smooth',
})
console.log('following new user');
button.click();
}
else {
const findMore = document.querySelector('.bsky-reload-btn');
if (findMore) {
console.log('loading more');
findMore.scrollIntoView({
behavior: 'smooth',
})
findMore.click();
}
else {
console.log('no matches found');
}
}
}
var intervalId = setInterval(loop, 1000);
@schilke
Copy link

schilke commented Sep 10, 2023

Hi there, thanks for this snippet. Looks like I'm missing something because the button.click(); event for the "Follow on Bluesky" button doesn't seem to work for me 😬

@schilke
Copy link

schilke commented Sep 14, 2023

Looks like the CSS class names have changed:

  • .follow-button > .action-button
  • .follow-button__following > .action-button__being
  • .follow-button__processing > .action-button__just-applied

@henrysachs
Copy link

adapted version

var loop = () => {
  const buttons = Array.from(document.querySelectorAll('.action-button:not(.action-button__being):not(.action-button__just-applied)'));
  const button = buttons?.[0];
  if (button) {
    button.scrollIntoView({
      behavior: 'smooth',
    })
    console.log('following new user');
    button.click();
  }
  else {
    const findMore = document.querySelector('.bsky-reload-btn');
    if (findMore) {
      console.log('loading more');
      findMore.scrollIntoView({
        behavior: 'smooth',
      })
      findMore.click();
    }
    else {
      console.log('no matches found');
    }
  }
}

var intervalId = setInterval(loop, 1000);

@andrewpomeroy
Copy link
Author

Updated — thanks @henrysachs & @schilke!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment