Skip to content

Instantly share code, notes, and snippets.

@berstend
Last active April 22, 2025 10:10
Show Gist options
  • Save berstend/752e7b54fd0bbd8b672882459d149b60 to your computer and use it in GitHub Desktop.
Save berstend/752e7b54fd0bbd8b672882459d149b60 to your computer and use it in GitHub Desktop.
Mass unfollow users on Instagram (no app needed)
  • Go to your profile on instagram.com (sign in if not already)
  • Click on XXX following for the popup with the users you're following to appear
  • Open Chrome Devtools and Paste the following into the Console and hit return:
(async function(){
  const UNFOLLOW_LIMIT = 800
  const delay = (ms) => new Promise(_ => setTimeout(_, ms))
  const findButton = (txt) => [...document.querySelectorAll("button").entries()].map(([pos, btn]) => btn).filter(btn => btn.innerHTML === txt)[0]

  console.log("Start")
  for (let i = 0; i < UNFOLLOW_LIMIT; i++) {
    const $next = findButton("Following")          
    if (!$next) { continue }
    $next.scrollIntoViewIfNeeded()  
    $next.click()
    await delay(100)
    $confirm = findButton("Unfollow")    
    if ($confirm) {
      $confirm.click()
    }

    await delay(20 * 1000) // Wait 20s, 200 unfollows per hour limit
    console.log(`Unfollowed #${i}`)
  }

  console.log("The end")
})()
@hashilbasheer
Copy link

is there any way to unfollow the people who are not following you back?

@thekyeal
Copy link

thekyeal commented Mar 1, 2025

Updated code

const UNFOLLOW_LIMIT = 800;
const UNFOLLOW_INTERVAL = 100; // Avoid 0 to prevent browser throttling
const BREAK_DURATION = 5 * 60 * 1000; // 5 minutes break
const TOTAL_DURATION = 10 * 60 * 1000; // 10 minutes duration

let stopScript = false;

const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));

const findButton = (txt) =>
[...document.querySelectorAll("button")]
.find((btn) => btn.textContent.includes(txt));

console.log("Start");

(async function () {
let startTime = Date.now();

// Stop the script when user sets stopScript = true
document.addEventListener("keydown", (event) => {
    if (event.key === "Escape") {
        stopScript = true;
        console.log("Script stopping...");
    }
});

while (Date.now() - startTime < TOTAL_DURATION && !stopScript) {
    let unfollowCount = 0;

    for (let i = 0; i < UNFOLLOW_LIMIT && !stopScript; i++) {
        const $next = findButton("Following");
        if (!$next) {
            console.log("No more users to unfollow.");
            break;
        }

        $next.scrollIntoView({ behavior: "smooth", block: "center" });
        await delay(200); // Allow scroll to settle

        $next.click();
        await delay(300); // Wait for confirmation button to appear

        const $confirm = findButton("Unfollow");
        if ($confirm) {
            $confirm.click();
            console.log(`Unfollowed #${i + 1}`);
            unfollowCount++;
        } else {
            console.warn("Unfollow confirmation button not found.");
        }

        await delay(UNFOLLOW_INTERVAL);
    }

    if (unfollowCount === 0) {
        console.log("No more actions possible, stopping.");
        break;
    }

    console.log(`Taking a break for ${BREAK_DURATION / 1000} seconds...`);
    await delay(BREAK_DURATION);
}

console.log("Task completed");

})();

@dasrii
Copy link

dasrii commented Mar 2, 2025

(async function(){
const UNFOLLOW_LIMIT = 800
const delay = (ms) => new Promise(_ => setTimeout(_, ms))
const findButton = (txt) => [...document.querySelectorAll("button").entries()].map(([pos, btn]) => btn).filter(btn => btn.innerText === txt)[0]

console.log("Start")

for (let i = 0; i < UNFOLLOW_LIMIT; i++) {
const $next = findButton("Following")
if (!$next) { continue }
$next.scrollIntoViewIfNeeded()
$next.click()
await delay(100)
$confirm = findButton("Unfollow")
if ($confirm) {
$confirm.click()
}

await delay(1 * 1000) // Wait 1s, 500 unfollows per hour limit
console.log(`Unfollowed #${i}`)

}

console.log("The end")
})()

This is working on 2 March 2025

@korkom5910
Copy link

The key arrived almost immediately after I completed the purchase, and the activation process was seamless. I simply entered the key, followed the instructions, and within minutes, my Windows 11 Pro was fully activated without any problems. It felt like a huge relief since I didn’t have to worry about expiration or activation errors.

And they partnered with microsoft

@12mbaabeh12
Copy link

If you are looking to get real instagram followers & likes for cheap price, i suggest you to check out this service https://shorturl.at/2tjUZ . I have used them couple of times in past 1 month and they deliver real followers & likes. It can take upto 24 hours to get all the followers. I personally also noticed some engagement after i received my followers. My recent posts got many new likes which was quite surprising.

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