DEV Community

Cover image for JavaScript Instagram Bot P2
Danijela.js๐Ÿ›ธ
Danijela.js๐Ÿ›ธ

Posted on

5 2

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) {
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 ๐Ÿ˜

Sentry blog image

How I fixed 20 seconds of lag for every user in just 20 minutes.

Our AI agent was running 10-20 seconds slower than it should, impacting both our own developers and our early adopters. See how I used Sentry Profiling to fix it in record time.

Read more

Top comments (3)

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
 
hmble profile image
hmble โ€ข
Comment hidden by post author
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

SurveyJS custom survey software

JavaScript Form Builder UI Component

Generate dynamic JSON-driven forms directly in your JavaScript app (Angular, React, Vue.js, jQuery) with a fully customizable drag-and-drop form builder. Easily integrate with any backend system and retain full ownership over your data, with no user or form submission limits.

Learn more

๐Ÿ‘‹ Kindness is contagious

Please leave a โค๏ธ or a friendly comment on this post if you found it helpful!

Okay