├── .github └── FUNDING.yml ├── .gitignore ├── 1.png ├── 2.png ├── Instagram Bot Ppt.pdf ├── README.md ├── instabot.py └── requirements.txt /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | custom: ['https://www.buymeacoffee.com/alisolanki'] 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /env 2 | -------------------------------------------------------------------------------- /1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alisolanki/instagram-bot-python/6bfaaaccfbe13eaddc04f2ce310829727eb05b0d/1.png -------------------------------------------------------------------------------- /2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alisolanki/instagram-bot-python/6bfaaaccfbe13eaddc04f2ce310829727eb05b0d/2.png -------------------------------------------------------------------------------- /Instagram Bot Ppt.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alisolanki/instagram-bot-python/6bfaaaccfbe13eaddc04f2ce310829727eb05b0d/Instagram Bot Ppt.pdf -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # instagram-bot-python 2 | Instagram Bot that sends messages to multiple people using tkinter and an easy to use GUI. 3 | 4 | ## Preview 5 | 6 | 7 | 8 | ## Presentation 9 | https://github.com/alisolanki/instagram-bot-python/blob/master/Instagram%20Bot%20Ppt.pdf 10 | 11 | ## Installation 12 | 1. Download virtual environment if not installed already through your terminal/cmd: 13 |
`python3 -m pip install --user virtualenv` 14 | 15 | 2. Create a python virtual environment so that the dependencies need not be installed globally: 16 |
Make sure you name it 'env' for the .gitignore 17 |
`python3 -m venv env` 18 |
Mac: 19 |
`source env/bin/activate` 20 |
Windows: 21 |
`.\env\Scripts\activate` 22 | 23 | 3. Install all the dependencies: 24 |
`pip install -r requirements.txt` 25 | 26 | 4. You're all set to go: 27 |
`python instabot.py` 28 |
OR 29 |
`python3 instabot.py` 30 | 31 |
32 | Created with 💜 by Ali Solanki 33 |
34 | -------------------------------------------------------------------------------- /instabot.py: -------------------------------------------------------------------------------- 1 | # importing module 2 | from selenium import webdriver 3 | import os 4 | import time 5 | from selenium.webdriver.common.by import By 6 | from selenium.webdriver.support.ui import WebDriverWait 7 | from selenium.webdriver.support import expected_conditions 8 | from selenium.webdriver.common.keys import Keys 9 | from webdriver_manager.chrome import ChromeDriverManager 10 | 11 | import tkinter as tk 12 | from tkinter import messagebox 13 | import pyttsx3 14 | 15 | driver = webdriver.Chrome(ChromeDriverManager().install()) 16 | 17 | 18 | def login(): 19 | try: 20 | if ent2.get() != str(ent2.get()): 21 | pass 22 | except: 23 | tk.messagebox.showerror( 24 | title="FAILED", 25 | message="\t\t Oops! \n You have entered wrong value. Numbers can't be text values!!! \n BYE" 26 | ) 27 | driver.close 28 | 29 | tk.messagebox.showinfo( 30 | title="SUCCESS", 31 | message=f"\t\tCongratulations!\n\n You are sending {str(ent1.get('1.0', tk.END))} text to {str(ent2.get())}" 32 | ) 33 | 34 | print('5') 35 | driver.get('https://www.instagram.com/') 36 | 37 | username = str(ent3.get()) 38 | password = str(ent4.get()) 39 | message = str(ent1.get('1.0', tk.END)) 40 | user = str(ent2.get()).split() 41 | 42 | enter_username = WebDriverWait(driver, 20).until( 43 | expected_conditions.presence_of_element_located((By.NAME, 'username'))) 44 | enter_username.send_keys(username) 45 | enter_password = WebDriverWait(driver, 20).until( 46 | expected_conditions.presence_of_element_located((By.NAME, 'password'))) 47 | enter_password.send_keys(password) 48 | enter_password.send_keys(Keys.RETURN) 49 | time.sleep(5) 50 | 51 | # first pop-up 52 | driver.find_element_by_xpath( 53 | '//*[@id="react-root"]/section/main/div/div/div/div/button').click() 54 | time.sleep(2) 55 | 56 | # 2nd pop-up 57 | driver.find_element_by_xpath( 58 | '/html/body/div[4]/div/div/div/div[3]/button[2]').click() 59 | time.sleep(2) 60 | 61 | # direct button 62 | driver.find_element_by_xpath( 63 | '//*[@id="react-root"]/section/nav/div[2]/div/div/div[3]/div/div[2]/a').click() 64 | time.sleep(3) 65 | 66 | # clicks on pencil icon 67 | driver.find_element_by_xpath( 68 | '//*[@id="react-root"]/section/div/div[2]/div/div/div[1]/div[1]/div/div[3]/button').click() 69 | time.sleep(2) 70 | for i in user: 71 | 72 | # enter the username 73 | driver.find_element_by_xpath( 74 | '/html/body/div[5]/div/div/div[2]/div[1]/div/div[2]/input').send_keys(i) 75 | time.sleep(2) 76 | 77 | # click on the username 78 | driver.find_element_by_xpath( 79 | '/html/body/div[5]/div/div/div[2]/div[2]/div[1]/div/div[3]/button').click() 80 | time.sleep(2) 81 | 82 | # next button 83 | driver.find_element_by_xpath( 84 | '/html/body/div[5]/div/div/div[1]/div/div[2]/div/button').click() 85 | time.sleep(3) 86 | 87 | # click on message area 88 | send = driver.find_element_by_xpath( 89 | '//*[@id="react-root"]/section/div/div[2]/div/div/div[2]/div[2]/div/div[2]/div/div/div[2]/textarea') 90 | 91 | # types message 92 | send.send_keys(message) 93 | time.sleep(1) 94 | 95 | # send message 96 | send.send_keys(Keys.RETURN) 97 | time.sleep(2) 98 | 99 | # clicks on direct option or pencl icon 100 | driver.find_element_by_xpath( 101 | '//*[@id="react-root"]/section/div/div[2]/div/div/div[1]/div[1]/div/div[3]/button').click() 102 | time.sleep(2) 103 | 104 | 105 | engine = pyttsx3.init() 106 | engine.say("Welcome to Ali's Instagram Bot") 107 | engine.runAndWait() 108 | 109 | window = tk.Tk() 110 | window.title("Instagram Bot by Ali") 111 | window.geometry("800x400") 112 | window.configure(bg="#494949") 113 | 114 | tk.Label(window, text="Welcome", font=( 115 | "Gill Sans", 36), bg="#F0FF00").pack(pady=10) 116 | tk.Label(window, text="Type the text :- ", 117 | font=("Gill Sans", 20), bg="#00FAFA").pack(pady=10) 118 | ent1 = tk.Text(window) 119 | ent1.place(x=10, y=120, height=100, width=750) 120 | 121 | tk.Label(window, text="Enter usernames:- ", 122 | font=("Gill Sans", 20), bg="#00FAFA").place(x=20, y=240) 123 | ent2 = tk.Entry(window) 124 | ent2.place(x=350, y=240, width=300) 125 | 126 | tk.Label(window, text="Your username:-", 127 | font=("Gill Sans", 20), bg="#00FAFA").place(x=20, y=280) 128 | ent3 = tk.Entry(window) 129 | ent3.place(x=20, y=320) 130 | 131 | tk.Label(window, text="Your password:-", 132 | font=("Gill Sans", 20), bg="#00FAFA").place(x=350, y=280) 133 | ent4 = tk.Entry(window, show="*") 134 | ent4.place(x=350, y=320) 135 | 136 | button1 = tk.Button(window, text="SUBMIT", 137 | font=("Gill Sans", 20), bg="#18D848", 138 | command=login) 139 | button1.place(x=350, y=360) # pack issue 140 | window.mainloop() 141 | 142 | # when our program ends it will show "done". 143 | input("DONE") 144 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | selenium 2 | webdriver-manager 3 | pyttsx3 --------------------------------------------------------------------------------