-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstagram.py
More file actions
53 lines (45 loc) · 1.61 KB
/
instagram.py
File metadata and controls
53 lines (45 loc) · 1.61 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains
import time
import platform
# Variables
sendDelay = 1
username = input("Please enter your username: ")
print("Your username is: " + username)
print("Next step is your password.")
password = input("Please enter your password: ")
print("Success, finnaly enter friend name to send text to.")
friendName = input("Please enter friend name: ")
print("Starting...")
# Checks if on Mac or Windows
if platform.system() == "Windows":
driver = webdriver.Chrome('chromedriver.exe')
else:
driver = webdriver.Chrome()
# Opens Discord
driver.get('https://www.instagram.com/')
time.sleep(3)
# Login
driver.find_element_by_xpath('//*[@name="username"]').send_keys(username)
driver.find_element_by_xpath('//*[@name="password"]').send_keys(password)
driver.find_element_by_xpath('//*[@type="submit"]').click()
# Waits 8 seconds to finish loading page
time.sleep(6)
# driver.find_element_by_xpath('//*[@type="button"]').click()
# time.sleep(1)
driver.find_element_by_xpath("//a[@href='/direct/inbox/']").click()
time.sleep(3)
# Finds user in DM list
getUser = driver.find_element_by_xpath("//*[contains(text(), '" + friendName + "')]").click()
movie_script = []
print("Reading text file...")
with open('arkek.txt', "r") as f:
for line in f.readlines():
for word in line.split():
print(word)
# Types words and submits
actions = ActionChains(driver)
actions.send_keys(word, Keys.ENTER)
actions.perform()
time.sleep(sendDelay)