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..
![](https://learnscraping.com/wp-content/uploads/2018/11/pdeoqlqfapg.jpg)
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.
![](https://learnscraping.com/wp-content/uploads/2019/01/2ejcsulrwc8-1024x683.jpg)
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 7 extra hours of great content on web scraping with nodejs.
Could this be used to automate likes and comments?
Yes, it can be used to do this but of course, this is just a simple approach to it and it would have to be more complex if you really want to do this.