In this video, I made a bot that likes (n) number of posts of ANY given profile.
I Made a Bot that LIKES every post of SELENA GOMEZ !!
Making a bot to automate Instagram
How to make a bot using python
Automate boring stuff with python
How I made a bot to automate Instagram
-- SOURCE CODE --
from selenium import webdriver
import time
import keyboard
path = 'C:/Users/raghu/OneDrive/Desktop/chromedriver.exe'
driver = webdriver.Chrome(path)
LOGIN
driver.get('https://www.instagram.com')
time.sleep(2)
usernameField = driver.find_element_by_xpath('//*[@id="loginForm"]/div/div[1]/div/label/input')
usernameField.send_keys('YOUR INSTAGRAM ID')
passwordField = driver.find_element_by_xpath('//*[@id="loginForm"]/div/div[2]/div/label/input')
passwordField.send_keys('YOUR INSTAGRAM PASSWORD')
loginButton = driver.find_element_by_xpath('//*[@id="loginForm"]/div/div[3]/button/div')
time.sleep(2)
loginButton.click()
SEARCH
time.sleep(5)
searchBar = driver.find_element_by_xpath('//*[@id="react-root"]/section/nav/div[2]/div/div/div[2]/input')
searchBar.send_keys('selenagomez')
time.sleep(1)
keyboard.press('enter')
keyboard.press('enter')
keyboard.press('enter')
keyboard.press('enter')
PROFILE ENTERED
time.sleep(5)
firstPic = driver.find_element_by_xpath(
'//*[@id="react-root"]/section/main/div/div[3]/article/div[1]/div/div[1]/div[1]/a')
firstPic.click()
PIC OPENED
time.sleep(3.5)
likeButton = driver.find_element_by_xpath('/html/body/div[5]/div[2]/div/article/div[3]/section[1]/span[1]/button')
likeButton.click()
slideButton = driver.find_element_by_xpath('/html/body/div[5]/div[1]/div/div/a')
slideButton.click()
slideButton = driver.find_element_by_xpath('/html/body/div[5]/div[1]/div/div/a[2]')
for i in range(25):
try:
time.sleep(0.5)
slideButton.click()
time.sleep(2)
likeButton = driver.find_element_by_xpath('/html/body/div[5]/div[2]/div/article/div[3]/section[1]/span[1]/button')
likeButton.click()
time.sleep(0.5)
except:
continue
print('DONE !!')
-----------------------
#instagramautomation #automation #pythonautomation #selenagomez #instaautomation #howto #automate #instagramautomation #raghuvansh #raghuvanshmani #igautomation #likesautomation #seleniumsutomation #imadeabot
Copyright disclaimer under section 107 of the copyright act 1976, allowance is made for fair use for purposes such as criticism, comment, news reporting, scholarship and research. Fair use is a use permitted by copyright statute that might otherwise be infringing. Non-profit, educational or personal use tips the balance in favour of fair use.