Skip to content

Instantly share code, notes, and snippets.

@JamieMason
Last active December 4, 2024 09:04
Show Gist options
  • Save JamieMason/c0becfbb42d3b358b38cc4b9186584ff to your computer and use it in GitHub Desktop.
Save JamieMason/c0becfbb42d3b358b38cc4b9186584ff to your computer and use it in GitHub Desktop.
Unfollow everyone on bsky.app

Unfollow everyone on bsky.app

By @foldleft.bsky.social, see also Unfollow everyone on twitter.com

This took 10 minutes so is pretty rough.

unfollow-all.mts

import { BskyAgent } from "@atproto/api";

// you only need to edit this part
const YOUR_USERNAME = "YOU.bsky.social";
const YOUR_PASSWORD = "yumyum";

const agent = new BskyAgent({
  service: "https://bsky.social",
});

await agent.login({
  identifier: YOUR_USERNAME,
  password: YOUR_PASSWORD,
});

async function deleteBatch() {
  const { data } = await agent.getFollows({
    actor: YOUR_USERNAME,
    limit: 20,
  });

  if (data.follows.length > 0) {
    await Promise.all(
      data.follows.map(async (follow) => {
        console.log(follow.handle);
        if (follow.viewer?.following) {
          await agent.deleteFollow(follow.viewer.following);
        }
      }),
    );
    deleteBatch();
  }
}

deleteBatch();

package.json

{
  "name": "bluesky",
  "description": "",
  "version": "0.0.0",
  "author": "https://github.com/JamieMason",
  "dependencies": {
    "@atproto/api": "^0.13.18",
    "tsx": "^4.19.2",
    "typescript": "^5.7.2"
  },
  "keywords": [],
  "license": "MIT"
}

tsconfig.json

{
  "$schema": "https://json.schemastore.org/tsconfig",
  "_version": "22.0.0",

  "compilerOptions": {
    "lib": ["es2023"],
    "module": "node16",
    "target": "es2022",

    "strict": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "moduleResolution": "node16"
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment