DEV Community

Cover image for JavaScript INSTAGRAM bot
Danijela.js๐Ÿ›ธ
Danijela.js๐Ÿ›ธ

Posted on

JavaScript INSTAGRAM bot

You know a little bit of JavaScript, and you want to build your following on Instagram, but don't want to share your password with some app, and you don't know BackEnd?! Don't worry, I got you fam! ๐Ÿ˜

I'm gonna show you how to build your personal instagram "bot" ๐Ÿ˜

  1. First, open Instagram in a new tab, log in, then type the hashtag you want, open the first image.

  2. Now you are gonna inspect the โค๏ธ button, the browser console will open, and you will see the class of the button. Usually you have to use the second or third class.

  3. Open the console. Create a variable by the name like, and do the same for the arrow pagination โžก๏ธ, calling the variable next. Access the button element and the pagination with querySelector.

  4. Now use the setInterval method.

  5. Using the if statement, if there is a like button add a click event for the button. Then add another click event for the pagination.

  6. Because Instagram likes to ban accounts with "strange" activities, set the interval to 15-20 seconds. And Voilร !

You now have your personal bot without "sharing" your password. You can use this for following people on instagram, or maybe on some other social media. It's up to you!

Btw I'm not sure if this classifies as a BOT, but it will help ๐Ÿ˜

Top comments (26)

Collapse
 
jiwebdev profile image
Nathan M • Edited

this works for me. Updated version August 6, 2020

Collapse
 
jose2016 profile image
Joseph Rodriguez

YES this one is working very good thanks for sharing @danijelajs and @jiwebdev

Collapse
 
samcologne profile image
samcologne

Seems that it doesn't work anymore. Anyone a solution?

Collapse
 
jiwebdev profile image
Nathan M

I fixed it. take a look ;)

Thread Thread
 
samcologne profile image
samcologne

Wow really good ideas, great job. Thank you.
But i couldn't run this one. This one is diffrent, Its for the feet, not for some #hashtag searches, right!?
The old one worked great. Im going to try to fix the old one with some of your new tools ;)
But the like button doens't work and the class name is the same like before, I think.

Collapse
 
alvarofelipe12 profile image
Alvaro Felipe Garcรญa Mรฉndez

I tried it and it worked... in the first photo, then in the second photo seems like the html that shows the pic and the like button, is destroyed and built again in a few seconds, so in the second photo it did the like.click() somewhere else but not in the second photo...but the next.click() works nice cause these a 'buttons' are not destroyed and changes to the next pic. Besides this, i found it very clever and fun. Can you confirm if my theory is true?

Collapse
 
danijelajs profile image
Danijela.js๐Ÿ›ธ • Edited

I'm not sure what you mean by "destroyed" ๐Ÿ˜‚ But when ever you click on the tab, it will load the code again. It's set to like every 20 seconds.

Collapse
 
ankit662002 profile image
ankit662002

Most of the instagram bots do not work anymore. The only instagram bot which works now is InstaCaptain.com . All the other Instagram Bots are now outdated and easily detected.

Collapse
 
danijelajs profile image
Danijela.js๐Ÿ›ธ

This is not really an instagram bot. Just a piece of code to use in browser console. So it works. Are you trying to advertise your own app here?

Collapse
 
gspteck profile image
GSPTeck • Edited

Yeah he is advertising his own app, because there are a ton of Instagram bots that work. lol

Collapse
 
champi profile image
Champi • Edited

This is so "simple" yet highly clever!
I've never though on messing around with the Instagram webapp in this way.

Cool

Collapse
 
danijelajs profile image
Danijela.js๐Ÿ›ธ

Thanks!๐Ÿ˜Š People don't use the browser console too often. You can do a lot of things with it, you just need a little bit of imagination ๐Ÿ˜Š

Collapse
 
_jayantsharma profile image
Jayant Sharma

Can you tell what this code or ur bot will do as am also a newbie.

Collapse
 
danijelajs profile image
Danijela.js๐Ÿ›ธ

It will like images with the same hashtag.

Collapse
 
_jayantsharma profile image
Jayant Sharma

Okk

Collapse
 
yanant profile image
yanant

This worked like a charm! But it looks like IG has picked up on the behaviour and started blocking the action from running :(

Collapse
 
danijelajs profile image
Danijela.js๐Ÿ›ธ

They probably just changed the class name. That's why you have to use the browser console.

Collapse
 
yanant profile image
yanant

Hmmm, I'll take a look once they lift my block. Thanks for the tip! :)

Collapse
 
dhanushkadev profile image
Dhanushka madushan

API was the first thing that comes into my mind when I heard making bot. Then getting API keys, setting up server, hundred lines of codes bla bla. But this is a clever simple way. Thank you.

Collapse
 
danijelajs profile image
Danijela.js๐Ÿ›ธ

I know. It doesn't require any Back-End knowledge, it's "easy peasy lemon squeezy"๐Ÿ‹๐Ÿ˜ Thanks, you are welcome. I'm glad I helped someone ๐Ÿ˜Š๐Ÿ‘๐Ÿป

Collapse
 
mostmojo profile image
Jacob Papageorgiou

This is great, is there one for twitter too? :)

Collapse
 
devrambeno profile image
devrambeno

I'm trying it out, sorry I'm new to this stuff, but I wasn't successful at setting it up. I keep getting Uncaught TypeError: Cannot read property 'click' of null

Collapse
 
danijelajs profile image
Danijela.js๐Ÿ›ธ

You have to type a hashtag in the search bar on insta, then open the first image, open the console.There is an image of the code here, just copy the code to the console, it should work.Good luck!๐Ÿ€๐Ÿ˜Š

Collapse
 
Sloan, the sloth mascot
Comment deleted
Collapse
 
danijelajs profile image
Danijela.js๐Ÿ›ธ

Thanks!๐Ÿ˜Š๐Ÿ™

Some comments may only be visible to logged-in visitors. Sign in to view all comments. Some comments have been hidden by the post's author - find out more