Today I will show you how to make a instagram bot in python this bot will help you automate instagram with this bot you can post a photo, follow, unfollow people, send messages, like or unlike posts and many other things which you can do on instagram.
I will show you step by step process to make a instagram bot in python It is very easy to create you we will use a python library called instabot to automate instagram it is free to use and you don’t need to have a instagram api for this.
If you are intrested in more projects like this then you can visit projects section I have created and posted a lot of projects with code you can check out here – coderzway projects.
Things you will be able to do after reading this article
- Make a instagram bot
- Automate instagram posting, following and more
Making a instagram bot in python
So let’s make a instagram bot if you are new to python than follow all the steps carefully I shown step by step guide to make a instagram bot in python.
1. Install python
Before we start if you don’t have python installed on your machine then you need to download and install python on your computer you can download python from here download python and remember to check add python to path.
I will be using vs code which is a code editor you can use anything pycharm or jupyter but if you want to use vs code you can download it from here – download vs code.
2. Create a python file
So first you need to create folder and open it with vs code or any other editor create a python file with .py extension write the name of the file and type .py at the end.
3. Install Instabot
Now you need to install the instabot library which you can do with pip which comes with python you need to open command prompt or terminal in your editor at your file location and type this command.
pip install instabot
This command will install the instabot library and you can use it in your projects.
4. Copy the Code
So now you need to write code in your python file so copy the below code and paste it in the file
# You need to install and import instabot # Remember to delete the config folder after each time you run # or it will give you a error from instabot import Bot bot = Bot() bot.login(username="Enter your instagram username",password="Enter your instagram password") # FOLLOWS A SINGLE PERSON bot.follow("followername") # Follow users from list. bot.follow(["activefollower1", "activefollower2"]) # Unfollow user bot.unfollow("username") # Unfollow users from list bot.unfollow_users(["username3", "username2"]) # Unfollows all non followers bot.unfollow_non_followers() # Uploads photo to your account. bot.upload_photo("/somephoto.jpg", caption="Nice pic!") # Downloads photo by id. bot.download_photo(["123"], filename="somefile.jpg") # Downloads photos by ids into given folder. bot.download_photos(["123","345"], "photos") # like — Like media_id by id bot.like("1231241210") # like_medias — Like medias from list. bot.like_medias(["1323124", "123141245"]) # unlike — Remove like from media. bot.unlike("12321412512") # unlike_medias — Remove likes from medias in list bot.unlike_medias(["123", "321"]) # like_timeline — Like medias from your timeline feed bot.like_timeline() # like_user — Like last user’s medias bot.like_user("activefollower") # like_hashtag — Like last medias with hashtag. bot.like_hashtag("dog")
You can run this code by typing this in the command prompt or clicking run button in the editor python filename.py
You need to enter your username and password of the account which you want to automate it is safe and you may a get email from instagram about login.
Remember to delete the config folder after running the program each time if you want more information you can see the documentation of instabot – Read documentation here
So this was instagram bot in python please don’t overuse it your account can get blocked by instagram for spam so don’t overlike or follow someone fast.
I hope you found what you were looking for and thank you for reading this article if you found any problems or errors you can comment them down and if you intrested in more projects than subscribe to our newsletter.