So last week during my internship one of the work assigned to me was to go and follow some random profiles on Instagram through the company’s page. You might wonder why would someone do that, even I thought the same but when I tried, it actually worked. Instagram’s algorithm suggests people to visit your account if you are active and follow people on daily basis. So I started following some profiles randomly, I even got some people following us but that wasn’t enough also I was very very bored following accounts like a robot, doing a repetitive task.
The making & fun part :
I thought to myself why not to make a bot that does this work for me in much faster and easy manner, I had some programming knowledge thanks to my Engineering in CS ( hi to all my Engineering peeps). I used Python with selenium web driver to build my bot which actually worked. You just need to mention your username and password then leave the rest to the bot, it automatically searches for profiles and follows them. You can also set the number of profiles you want to follow, there is no limit ! I had troubles initially due to some random pop-ups on Instagram page for which my bot wasn’t prepared and also the fact I followed way too many people on the very first day due to which I got a ban which prevented me from following anyone for next 24 hours, so modify the script according to avoid this :). At last with some modifications the script was completely ready and all set to rock the Instagram
After a week of implementing this bot, it was following 700 profiles and had 184 followers which infact is pretty great for an account that had no followers, post or any favourable thing. The more people you follow, the no of people following you will increase exponentially. The bot works very well and you can try it with your account too but beware following too many profiles can get you banned from Instagram. This is the code and also there is no limit in functionalities you can add on this bot. You can make a bot which likes the profile and even comments on random post or targeted posts through the tags.
The program is written in python and even a little knowledge of it is enough to understand the code, I used the selenium web driver to implement this program, here is the code if you want to try it for yourself. I will be giving a GitHub link to the code very soon, stay connected 😉
Where is the Code?
Below is the Python script that makes all these possible.
from selenium import webdriver from selenium.webdriver.firefox.webdriver import WebDriver from selenium.webdriver.common import keys import time from selenium.webdriver.remote.webelement import WebElement class InstaBot: driver = webdriver.Firefox() driver.get("https://www.instagram.com") time.sleep(2) login= driver.find_element_by_xpath("//a[@href='/accounts/login/?source=auth_switcher']") login.click() time.sleep(5) usern= driver.find_element_by_xpath("//input[@name='username']") usern.send_keys("botinsta21") passw= driver.find_element_by_xpath("//input[@name='password']") passw.send_keys("123BOT") time.sleep(4) enter= driver.find_element_by_class_name("_0mzm-.sqdOP.L3NKy") enter.click() time.sleep(4) followpa = driver.find_element_by_class_name("glyphsSpriteCompass__outline__24__grey_9.u-__7") POPUP = driver.find_element_by_class_name("aOOlW.HoLwm ") try: followpa.click() except: POPUP.click() followpa.click() time.sleep(2) nextpg= driver.find_element_by_class_name("Kf8kP.coreSpritePagingChevron") nextpg.click() nextpg.click() nextpg.click() nextpg.click() nextpg.click() followbut = driver.find_elements_by_class_name("_2dbep.qNELH.kIKUG") idd= [elem.get_attribute('href') for elem in followbut] for i in idd: driver.get(i) followacc= driver.find_element_by_class_name("_5f5mN.jIbKX._6VtSN.yZn4P") followacc.click() time.sleep(3) time.sleep(5)