It is a python automated script that likes all posts of a particular ig user and takes screenshots along with it.
These should run without any error:
- All modules according to requirements
pip install -r requirements.txt
- Chrome webdriver should be installed
- Path of Chrome Browser should be added to PATH
from selenium import webdriver
import time
def login():
driver.maximize_window()
driver.get('https://www.instagram.com/')
driver.implicitly_wait(10)
print("Logging you into your account")
driver.find_element_by_xpath(
'//*[@id="react-root"]/section/main/article/div[2]/div[1]/div/form/div[2]/div/label/input').send_keys(username)
sleep(1)
driver.find_element_by_xpath(
'//*[@id="react-root"]/section/main/article/div[2]/div[1]/div/form/div[3]/div/label/input').send_keys(password)
sleep(1)
driver.find_element_by_xpath(
'/html/body/div[1]/section/main/article/div[2]/div[1]/div/form/div[4]/button').click()
sleep(1)
try:
driver.find_element_by_xpath(
'//*[@id="react-root"]/section/main/div/div/div/div/button').click()
except Exception as e:
print("Successfully logged in" + str(e))
sleep(3)
try:
driver.find_element_by_xpath(
'/html/body/div[4]/div/div/div[3]/button[2]').click()
except Exception as e:
print("Successfully logged in" + str(e))
Then starting to send likes to the user account (Make sure you're following that user or the user is public)
def main():
print('Starting to send likes to user')
driver.get('https://www.instagram.com/' + user + '/')
driver.implicitly_wait(10)
driver.find_element_by_xpath(
'/html/body/div[1]/section/main/div/div[3]/article/div[1]/div/div[1]/div[1]/a').click()
sleep(1)
i = 0
while i < num:
driver.find_element_by_xpath(
'/html/body/div[4]/div[2]/div/article/div[2]/section[1]/span[1]/button').click()
driver.save_screenshot('like' + str(i) + '.png')
sleep(1)
driver.find_element_by_class_name(
'coreSpriteRightPaginationArrow').click()
i += 1
sleep(1)
chrome_options.add_argument('--headless')
chrome_options.add_argument('--disable-gpu')
Free Software, Hell Yeah!