DEV Community

Cover image for JavaScript Instagram Bot P2

Posted on

JavaScript Instagram Bot P2

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) {;
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 😁

Top comments (3)

sadaca73 profile image

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.


hmble profile image
Info Comment hidden by post author - thread only accessible via permalink

If you guys are interested in using python then theres a library for private api

I use this gist to unsave my saved posts.

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