-
-
Save chaodonghu/c942b6ca8f8c247ccacd3b0123ff3580 to your computer and use it in GitHub Desktop.
| // Run GOOGLE CHROME - WORKING AS OF MARCH 23 2025 | |
| // Please @ me in the comments if this stops working, I will try to get it working again within the month | |
| // INSTRUCTIONS | |
| // 1. Open Instagram in Chrome | |
| // 2. Click on "FOLLOWING" on your Instagram profile | |
| // 3. Open developer tools by right clicking on the page and clicking "INSPECT" | |
| // 4. Copy the code below and paste in the developer tools console and press enter to run | |
| // 5. Script will not run if tab is navigated away from, minimized of unfocused (It is recommended to open a new chrome window or push tab to the side and let script run in background) | |
| const unfollowEveryone = (async () => { | |
| // Modify these variables to your liking | |
| // UNFOLLOW_LIMIT is the number of users to unfollow (this is set to 1000) | |
| const UNFOLLOW_LIMIT = 1000; | |
| const BREAK_DURATION = 5 * 60 * 1000; // 5 minutes break | |
| const TOTAL_DURATION = 10 * 60 * 1000; // 10 minutes duration - Timeout after 10 minutes | |
| const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); | |
| // Find target button | |
| const findButtonByText = (text) => | |
| Array.from(document.querySelectorAll("button")).find( | |
| (button) => button.innerText === text | |
| ); | |
| console.log("Start unfollowing script..."); | |
| let startTime = new Date().getTime(); | |
| // Track the number of unfollows | |
| let unfollowCount = 0; | |
| while (new Date().getTime() - startTime < TOTAL_DURATION) { | |
| for (let i = 0; i < UNFOLLOW_LIMIT; i++) { | |
| // UNFOLLOW_INTERVAL is the interval between unfollows | |
| // Increase UNFOLLOW_INTERVAL if you are getting rate limited | |
| // Set this to 0 unfollow as quickly as possible - not recommended | |
| // Random unfollow interval for each follow to avoid rate limiting minimum 5 seconds | |
| // This gets reset to a random number every loop | |
| const UNFOLLOW_INTERVAL = Math.floor(Math.random() * 10 + 1) * 5000; | |
| const followingButton = findButtonByText("Following"); | |
| if (!followingButton) { | |
| console.log("No more users to unfollow or unable to find button."); | |
| break; | |
| } | |
| followingButton.scrollIntoViewIfNeeded(); | |
| await followingButton.click(); | |
| await delay(100); // Short delay to ensure button is clicked | |
| const confirmUnfollowButton = findButtonByText("Unfollow"); | |
| if (confirmUnfollowButton) { | |
| await confirmUnfollowButton.click(); // Wait for the unfollow to complete | |
| unfollowCount++; | |
| console.log(`Unfollowed #${unfollowCount}`); | |
| } else { | |
| console.log("No unfollow confirmation button found."); | |
| } | |
| console.log(`Wait ${UNFOLLOW_INTERVAL} milliseconds`); | |
| await delay(UNFOLLOW_INTERVAL); | |
| } | |
| console.log(`Taking a break for ${BREAK_DURATION / 1000 / 60} minutes...`); | |
| await delay(BREAK_DURATION); // Take a break to avoid rate limiting | |
| startTime = new Date().getTime(); // Reset start time for the next cycle | |
| } | |
| console.log("Unfollow script complete!"); | |
| })(); |
@rashadraz we could discuss privately if you need the script modified for this purpose tho ..
@chaodonghu please look into the unfollow interval .. it generates upto a 45 second delay .. i will look to modify the script on my end
& also this is better ..
const INTERVAL_SECONDS = Math.round(UNFOLLOW_INTERVAL / 1000);
console.log(`Wait ${INTERVAL_SECONDS} seconds`);i was thinking .. what about a code that randomly picks between 5000ms - 10000ms for the interval
UPDATE: here's the code . you can put the numbers in variables ..
const UNFOLLOW_INTERVAL = Math.floor(Math.random() * (10000 - 5000 + 1) + 5000);My full fix to the script . 500+ unfollowed so far I guess it's good ...
const unfollowEveryone = (async function () { const UNFOLLOW_LIMIT = 100; // Reduced to stay under potential rate limits const UNFOLLOW_INTERVAL = 5000; // Increased interval to be more respectful of rate limits const UNFOLLOW_INTERVAL_TWO = 2500; // You can increase this to 5000 const BREAK_DURATION = 3 * 60 * 1000; // 3 minutes break const TOTAL_DURATION = 10 * 60 * 1000; // 10 minutes duration const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); const findButtonByText = (text) => Array.from(document.querySelectorAll("button")) .find((button) => button.innerText === text); console.log("Start"); let startTime = Date.now(); let unfollowCount = 0; while (Date.now() - startTime < TOTAL_DURATION) { for (let i = 0; i < UNFOLLOW_LIMIT; i++) { const followButton = findButtonByText("Following"); if (!followButton) { console.log("No more users to unfollow or unable to find button."); break; } followButton.scrollIntoViewIfNeeded(); await followButton.click(); await delay(100); // Short delay to wait for modal const confirmButton = findButtonByText("Unfollow"); if (confirmButton) { await delay(UNFOLLOW_INTERVAL_TWO); await confirmButton.click(); // Confirm unfollow unfollowCount++; console.log(`Unfollowed #${unfollowCount}`); } else { console.log("Confirmation button not found."); } await delay(UNFOLLOW_INTERVAL); } console.log(`Taking a break for ${(BREAK_DURATION / 1000) / 60} minutes...`); await delay(BREAK_DURATION); startTime = Date.now(); // Reset start time for the next cycle } console.log("The end"); })();800+ unfollowed so far without restrictions .. best mod for 2025 π
Awesome man you rock!!!!!!!!!!!!!!!
// ============================================================
// INSTAGRAM MASS UNFOLLOW β FAST MODE (NO BREAKS)
// Tab focus zaroori hai. Stop karne ke liye F12 > Console > Ctrl+C
// ============================================================
(async () => {
const UNFOLLOW_LIMIT = 999999; // Basically infinite β aap manually rokna
const DELAY_BETWEEN = 2000; // 2 sec between each unfollow (kam karo 1000 bhi chalega)
const SCROLL_INTERVAL = 5; // Har 5 unfollow ke baad scroll karega
const delay = (ms) => new Promise((r) => setTimeout(r, ms));
const findButton = (text) =>
Array.from(document.querySelectorAll("button")).find(
(btn) => btn.innerText.trim() === text
);
const scrollDialog = () => {
const dialog = document.querySelector('div[role="dialog"]');
if (!dialog) return false;
const scrollables = dialog.querySelectorAll("div");
for (const el of scrollables) {
if (el.scrollHeight > el.clientHeight && el.scrollHeight > 300) {
el.scrollTop = el.scrollHeight;
return true;
}
}
return false;
};
console.log(
"%c FAST UNFOLLOW MODE β Let's Go! π",
"color: #ff0040; font-size: 18px; font-weight: bold"
);
console.log("Stop karna hai toh Console mein Ctrl+C dabao ya tab band karo.\n");
let count = 0;
for (let i = 0; i < UNFOLLOW_LIMIT; i++) {
const btn = findButton("Following");
if (!btn) {
console.log("β Koi 'Following' button nahi mila. Scroll kar rahe hain...");
scrollDialog();
await delay(2000);
const retry = findButton("Following");
if (!retry) {
console.log("β
Done β koi aur users nahi bache.");
break;
}
retry.scrollIntoViewIfNeeded();
await delay(300);
retry.click();
} else {
btn.scrollIntoViewIfNeeded();
await delay(200);
btn.click();
}
await delay(400);
const confirmBtn = findButton("Unfollow");
if (confirmBtn) {
confirmBtn.click();
count++;
console.log(`β
Unfollowed #${count}`);
} else {
console.warn("β οΈ Unfollow button nahi mila, skip.");
}
// Har SCROLL_INTERVAL unfollow ke baad scroll karo
if (count % SCROLL_INTERVAL === 0) {
scrollDialog();
}
await delay(DELAY_BETWEEN);
}
console.log(\nπ― Total unfollowed: ${count});
})();
@chaodonghu hmm so I guess the following button only triggers the confirmation html div ... right?