Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions Insta-Bot-Follow-SendMsg/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# instabot.py
## What is the use:
Given a username if the Instagram account is public , will auto-follow and send msg.
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 user id of users whom you want to follow and send msg.

3. Then it will ask for the username and password for the account that will be used to follow and send msg.

4. Then it will automatically go to the username of the person whom you want to follow and send msg.

4. After pressing enter, it will automatically open the Instagram account of the user and follow and send msg .

5. Once done, it will Show the Msg.

## 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


## By Vivek Kumar Patel
53 changes: 53 additions & 0 deletions Insta-Bot-Follow-SendMsg/instabot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
from selenium import webdriver
import time
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from openpyxl import load_workbook
from selenium.webdriver.common.action_chains import ActionChains

browser = webdriver.Chrome(ChromeDriverManager().install())
time.sleep(10)
users=list(map(str,input("Enter Users Username Comma-Separated Whom You Want to Follow and Send Msg ").split(",")))
USERNAME=input("Enter Your Username ")
PASSWORD=input("Enter Your password ")

browser.get('https://www.instagram.com/')
wait = WebDriverWait(browser, 120)
time.sleep(2)

username_field = browser.find_element_by_name('username')
username_field.send_keys(USERNAME)

password_field = browser.find_element_by_name('password')
password_field.send_keys(PASSWORD)

login_btn = browser.find_element_by_css_selector('button[type="submit"]')
login_btn.click()
print(users)
time.sleep(5)
for user in users:
browser.get(f"https://www.instagram.com/{user}/")
time.sleep(3)
try:
follow = wait.until(EC.presence_of_element_located((By.XPATH,'//*[@id="react-root"]/section/main/div/header/section/div[1]/div[1]/div/div/div/span/span[1]/button')))
follow.click()
time.sleep(3)
except:
pass
try:
message = browser.find_element_by_class_name('_862NM ')
message.click()
time.sleep(4)
browser.find_element_by_class_name('mt3GC').click()
time.sleep(5)
mbox = browser.find_element_by_tag_name('textarea')
mbox.send_keys(input("Write Msg you Want to Send "))
mbox.send_keys(Keys.RETURN)
time.sleep(5)
except:
pass