Skip to content

Instantly share code, notes, and snippets.

@chaodonghu
Last active May 8, 2024 17:13
Show Gist options
  • Save chaodonghu/c25c7ee3e3eb85c0a0de051892e596a4 to your computer and use it in GitHub Desktop.
Save chaodonghu/c25c7ee3e3eb85c0a0de051892e596a4 to your computer and use it in GitHub Desktop.
Google Chrome script that allows user to mass follow instagram users on another's profile
// Run GOOGLE CHROME - WORKING AS OF DEC 26 2023
// 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 "FOLLOWERS" OR "FOLLOWING" on your Instagram profile or a desired user's 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)
// Script will follow everyone on the page until it reaches the follow limit or the time limit
// Script will take a break after the follow limit is reached to avoid rate limiting
const followEveryone = (async () => {
// Modify these variables to your liking
const FOLLOW_LIMIT = 800;
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 findButton = (txt) =>
[...document.querySelectorAll("button").entries()]
.map(([pos, btn]) => btn)
.filter((btn) => btn.innerText === txt)[0];
console.log("Start following script...");
let startTime = new Date().getTime();
while (new Date().getTime() - startTime < TOTAL_DURATION) {
for (let i = 0; i < FOLLOW_LIMIT; i++) {
const followButton = findButton("Follow");
if (!followButton) {
continue;
}
followButton.scrollIntoViewIfNeeded();
followButton.click();
await delay(100);
const confirmFollowButton = findButton("follow");
if (confirmFollowButton) {
await confirmFollowButton.click(); // Wait for the follow to complete
}
// Increase FOLLOW_INTERVAL if you are getting rate limited
// Set this to 0 follow as quickly as possible - not recommended
// Random follow interval for each follow to avoid rate limiting
const FOLLOW_INTERVAL = Math.floor(Math.random() * 10 + 1) * 1000;
console.log(`Wait ${FOLLOW_INTERVAL} milliseconds`);
await delay(FOLLOW_INTERVAL);
console.log(`Followed #${i + 1}`);
}
console.log(`Taking a break for ${BREAK_DURATION / 1000} seconds...`);
await delay(BREAK_DURATION); // Take a break to avoid rate limiting
startTime = new Date().getTime(); // Reset start time for the next cycle
}
console.log("Follow script complete!");
})();
@Kynv94
Copy link

Kynv94 commented Mar 1, 2022

@chaodonghu thank you so much
pls tag me when you're done <3 <3 <3 xoxo
have a nice week

@chaodonghu
Copy link
Author

Hey @Kynv94,

Sorry for the delay. Just modified the code to grab the follow buttons and tested it out. It should be working again.

Screen Shot 2022-03-13 at 10 34 46 PM

@Kynv94
Copy link

Kynv94 commented Mar 20, 2022

Thank you @chaodonghu so much (y) (y) (y)

@D1rtyC0de
Copy link

Hi is this code still working ?!

@chaodonghu
Copy link
Author

Hi is this code still working ?!

Hi @D1rtyC0de, sorry for the late reply, the code should be working as of Dec 26 2023. I just updated the code.

@alpsn
Copy link

alpsn commented May 2, 2024

Hi @chaodonghu, I just can't get my settings right... it would be very cool if you could help me :)

The above script setting follows me too quickly and in my opinion there is a risk of being banned.

How I would like it:
One follower per minute > 60 in one hour (limit) > break of 10 minutes > and this until a maximum of 300 followers are reached per day.

How should I move forward? Can you please help me?

peace

@chaodonghu
Copy link
Author

@alpsn You would have to change the variables

const FOLLOW_LIMIT = 300;
const BREAK_DURATION = 10 * 60 * 1000; // 5 minutes break

const TOTAL_DURATION = 60 * 60 * 1000; // 60 minutes duration

...

const FOLLOW_INTERVAL = Math.floor(Math.random() * 10 + 1) * 60000; // Runs once every minute

The above script setting follows me too quickly and in my opinion there is a risk of being banned.

You won't get banned, instagram will usually detect that theres some scripting going on in your account and you might get locked but you will just be required to reset your password.

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