Skip to content

It is a python automated script that likes all posts of a particular ig user and takes screenshots along with it.

License

Notifications You must be signed in to change notification settings

vashukarn/instagram-liker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

instagram-liker

N|Solid

Build Status

General Information

It is a python automated script that likes all posts of a particular ig user and takes screenshots along with it.

Prerequisites

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

First you're logged into your instagram account for which you have to fill your correct credentials

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)

If you want to go headless just uncomment these two lines

chrome_options.add_argument('--headless')
chrome_options.add_argument('--disable-gpu')

License:

MIT

Free Software, Hell Yeah!

About

It is a python automated script that likes all posts of a particular ig user and takes screenshots along with it.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages