Building an Instagram Bot with NodeJs & Puppeteer

We’re gonna dive directly into creating an Instagram Bot that goes through Tags, likes them and moves on until is stopped.Here are the results about it..

Table of contents

The Plan 💻

For me, this is pretty straight forward and here are my thoughts on this:

  • We need a browser API that will let us control the actions
  • We need to access the instagram login page, add the credentials and login
  • Make sure to handle the case where it would ask for a security code when logging in
  • Start to go through specified tags pages
  • Get the latest 3 images and iterate over them and like them if they are not already liked
  • Change the tag and repeat the process until the NodeJs process is finished

In order to achieve this, we are going to use Puppeteer by Google with NodeJs so that we can control the Chromium browser and automate the process that I’ve specified above.

Difficulty

The instagram website is a dynamically rendered one so in this case, that is why we are using Puppeteer.

Puppeteer gives you the option to work with websites like Instagram because it is basically a browser that listens and executes your commands.

This is a more Intermediate level project because you would need to have the basics ready in order to achieve this project in a timely manner.

Enjoy.

The process.

Here is a 40+ minutes video on how I achieved this and my thinking on this project.

Keep in mind, it is just a simple test to see if this works.

Full code

In this case, I am NOT going to provide the full code because this can be used for spam and I do not want that and I dont recommend this.

Thank you for understanding

Learning more 📚

Also if you want to learn more and go much more in-depth with the downloading of files, I have a great course with more  hours of secret content on web scraping with nodejs.

Leave a Reply

Your email address will not be published. Required fields are marked *