-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
41 lines (35 loc) · 1.46 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from flask import Flask,request,render_template
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from time import sleep
app = Flask(__name__, template_folder='template')
@app.route("/")
def index():
return render_template("index.html")
@app.route("/do",methods=["POST"])
def do():
User_Name=request.form.get("username")
Pass_Word=request.form.get("password")
Messages=request.form.get("message")
n=request.form.get("number")
TO_Whom=request.form.get("username2")
driver = webdriver.Chrome()
driver.get("http://www.instagram.com")
sleep(2)
driver.find_element_by_xpath('//input[@name="username"]').send_keys(User_Name)
driver.find_element_by_xpath('//input[@name="password"]').send_keys(Pass_Word)
driver.find_element_by_xpath('//button[@type="submit"]').click()
sleep(8)
driver.find_element_by_xpath('/html/body/div[1]/section/main/div/div/div/div/button').click()
sleep(3)
driver.find_element_by_xpath('/html/body/div[4]/div/div/div/div[3]/button[2]').click()
sleep(5)
driver.get("https://www.instagram.com/"+TO_Whom+"/")
sleep(5)
driver.find_element_by_xpath('//button[@type="button"]').click()
sleep(3)
print('MESSAGING!!')
for j in range(int(n)):
driver.find_element_by_xpath('//textarea[@placeholder="Message..."]').send_keys(Messages,Keys.ENTER)
sleep(2)
return "DONE!!!!"