DEV Community

loading...
Cover image for JavaScript Instagram Bot P2

JavaScript Instagram Bot P2

danijelajs profile image Danijela.js🛸 ・1 min read

Hi, This my second JavaScript Instagram "bot", but not actually a bot 😝, just a useful piece of code used in a smart way.

The best way to gain followers on Instagram is by following others who already follow people with similar content as yours.

BTW check out my previous article about my Instagram bot for likes for better clarification

Let's begin!
Like last time, you need to log in to your Instagram account on your computer, search for the account with similar content as yours, and click on their followers. Inspect the Follow button, and see which class the button has. Now, click on the browser console, and paste this code, don't forget to add the classes of the button.



var followed = 0;
setInterval(function() {
const button = document.querySelector('button.classes');
//change classes with classes you got when inspecting the button
if(button) {
button.click();
followed++;
console.log(`You followed ${followed} people`);
}
}, 10000);

-Keep in mind Instagram has the tendency to change the classes frequently.

P. S. Be careful, set the setInterval to at least 10-15 seconds so your account doesn't get banned 😁

You are welcome 😁

Discussion

pic
Editor guide
Collapse
sadaca73 profile image
Shawn

Hello Danijela,

I'm trying to implement this code, but it seems to be clicking the same follow button for the first instance over and over again. While the console logs that I followed however many new people it doesn't follow the 2nd account (just keeps clicking the first). I was proud that I even figured out the class thing here and get something working. Any chance you can help me figure this out?

Thanks, and BTW, I also implemented the first bot you posted about.

Cheers!

Collapse
vaibhavkhulbe profile image
Vaibhav Khulbe

That's where frontend devs are good at! Finding DOM and using classes. 😜

Some comments have been hidden by the post's author - find out more