Skip to content

Commit

Permalink
Added Instagram Liker Bot (Issue: #690) (#699)
Browse files Browse the repository at this point in the history
* Create test.txt

* Added Instagram Liker Bot Issue: #690

* Delete test.txt

* Added Instagram Liker Bot Issue: #690

* Update README.md

* Update README.md
  • Loading branch information
sujanrupu authored Aug 9, 2023
1 parent 33e258e commit f9e9a6b
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 1 deletion.
58 changes: 58 additions & 0 deletions Deployed Projects/Instagram_Liker_Bot/Instagram_Liker_Bot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.common.keys import Keys
from getpass import getpass
import time

chrome = webdriver.Chrome(ChromeDriverManager().install())
chrome.get("https://www.instagram.com")
time.sleep(10)

username = chrome.find_element_by_xpath(
'//*[@id="loginForm"]/div/div[1]/div/label/input')
username.send_keys(input("Enter your username: ")) # enter username
print("Enter your Password: ")
password = chrome.find_element_by_xpath(
'//*[@id="loginForm"]/div/div[2]/div/label/input')
pswd = getpass()
password.send_keys(pswd)
login_button = chrome.find_element_by_xpath('//*[@id="loginForm"]/div/div[3]')
login_button.click()
time.sleep(10)

search_bar = chrome.find_element_by_xpath(
'//*[@id="react-root"]/section/nav/div[2]/div/div/div[2]/input')
# enter the username to be searched
search_bar.send_keys(input("Enter the username of the other person: "))
time.sleep(7)
search_bar.send_keys(Keys.ENTER)
search_bar.send_keys(Keys.ENTER)

time.sleep(2)

post = chrome.find_element_by_xpath(
'//*[@id="react-root"]/section/main/div/div[3]/article/div[1]/div/div[1]/div[1]/a/div[1]/div[2]')
post.click()
time.sleep(2)
like_button = chrome.find_element_by_xpath(
'/html/body/div[5]/div[2]/div/article/div[3]/section[1]/span[1]/button')
like_button.click()
next_button = chrome.find_element_by_xpath(
'/html/body/div[5]/div[1]/div/div/a')
next_button.click()
time.sleep(2)

while True:
try:
like_button = chrome.find_element_by_xpath(
'/html/body/div[5]/div[2]/div/article/div[3]/section[1]/span[1]/button')
like_button.click()
next_button = chrome.find_element_by_xpath(
'/html/body/div[5]/div[1]/div/div/a[2]')
next_button.click()
time.sleep(5)
except:
close_button = chrome.find_element_by_xpath(
'/html/body/div[5]/div[3]/button')
close_button.click()
break
21 changes: 21 additions & 0 deletions Deployed Projects/Instagram_Liker_Bot/readMe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
What is the use:
Given a username if the Instagram account is public or the posts are accessible to the operator, will auto-like all the posts on behalf and exit.
Instructions to use:
1. Once we run the program, web driver will start the default browser under automated software (here we use chrome).

2. Then it will ask for the username and password for the account that will be used to give the likes.

3. Then it will automatically go to the search bar, and ask for the username of the person whose post you want to like.

4. After pressing enter, it will automatically open the Instagram account of the user and keep liking every available uploaded post.

5. Once done, it will close the posts itself.

Side note:
If you are using some other web browser, replace ‘chrome’ by the name of that browser
Modules and tools used:
Selenium, getpass and time

Development status: This is a complete version and the future version might function in adding auto-comments as well

BY SUJAN GHOSH
3 changes: 2 additions & 1 deletion Deployed Projects/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
5.) [Basic voice assistant.](https://github.com/The-Data-Alchemists-Manipal/MindWave/issues/257) <br>
6.) [SMS Spam Classifier.](https://github.com/shruti-2412/MindWave/tree/main/Deployed%20Projects/SMS-Spam-Classifier) <br>
7.) [Plant Disease Detection.](https://savi-plant-disease-detection-app.netlify.app/) <br>
8.) [SpaceInvader-Agent](https://github.com/ayush-09/MindWave/tree/sa/Deployed%20Projects/SpaceInvader-Agent)
8.) [SpaceInvader-Agent](https://github.com/ayush-09/MindWave/tree/sa/Deployed%20Projects/SpaceInvader-Agent) <br>
9.) [Instagram Liker Bot](https://github.com/sujanrupu/MindWave/tree/main/Deployed%20Projects/Instagram_Liker_Bot)

0 comments on commit f9e9a6b

Please sign in to comment.