-
Notifications
You must be signed in to change notification settings - Fork 1
/
run.py
73 lines (64 loc) · 2.11 KB
/
run.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
from time import sleep
from random import randint
from src.chromeDriver import driver, keys, by
from src.login import log_in
from randoms import messages
log_in()
sleep(3)
while True:
try:
driver.refresh()
sleep(5)
tweets = driver.find_elements(by=by.TAG_NAME, value='article')
tweet = tweets[3]
svgs = tweet.find_elements(by=by.TAG_NAME, value='svg')
svgs[3].click() # like
svgs[1].click() # comment
sleep(5)
reply_in = driver.find_element(
by=by.CLASS_NAME, value='public-DraftStyleDefault-block.public-DraftStyleDefault-ltr')
i = randint(0, len(messages)-1)
print('\n', i, '\n', messages[i])
sleep(3)
reply_in.send_keys(messages[i])
sleep(2)
reply_in.send_keys(keys.ENTER)
reply = driver.find_elements(by=by.TAG_NAME, value='span')
for r in reply:
if r.text == 'Reply':
r.click()
break
elif r.text == 'Unsent Tweet':
break
sleep(8)
except:
sleep(2)
driver.get('https://www.twitter.com/home')
continue
# tweets = driver.find_elements(by=By.TAG_NAME, value='article')
# for tweet in tweets:
# mess = tweet.find_elements(by=By.TAG_NAME, value='span')[4].text
# if mess == 'See more':
# mess = tweet.find_elements(by=By.TAG_NAME, value='span')[6].text
# print(mess)
# tweet.click()
# for tweet in tweets:
# try:
# svgs = tweet.find_elements(by=By.TAG_NAME, value='svg')
# svgs[1].click()#like
# svgs[5].click()
# except:
# svg
# tweet.find_elements(by=By.TAG_NAME, value='svg')[3].click() # like click
# sleep(1)
# tweet.find_elements(by=By.TAG_NAME, value='svg')[1].click() # comment click
# sleep(1)
# reply_in = driver.find_element(by=By.CLASS_NAME, value='public-DraftStyleDefault-block.public-DraftStyleDefault-ltr')
# i = randint(0, len(messages)-1)
# reply_in.send_keys (messages[i])
# reply = driver.find_elements(by=By.TAG_NAME, value='span')
# for r in reply:
# if r.text == 'Reply':
# r.click()
# break
# sleep(1)