-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
162 lines (132 loc) · 6.83 KB
/
main.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC, wait
import pyautogui
from random import randint
#open website and maximize in chrome
driver = webdriver.Chrome("D:/Users/Anton/Desktop/programming/chromedriver")
driver.get("http://www.volkno.com")
driver.fullscreen_window()
#check xpath function
def check_xpath(xpath):
try:
driver.find_element_by_xpath(xpath)
except NoSuchElementException:
return False
return True
#sign in
sign_in = driver.find_element_by_xpath("/html/body/div[1]/div/div/div/div[2]/section[1]/div[2]/div/div[1]/div/div[1]/a[2]")
sign_in.click()
time.sleep(0.5)
email = driver.find_element_by_xpath("/html/body/div[1]/div/div/div/div[2]/section[1]/div[2]/div/div[1]/div/div[2]/div/div[1]/form/div[1]/div/div/div/input")
email.send_keys("user")
time.sleep(0.5)
password = driver.find_element_by_xpath("/html/body/div[1]/div/div/div/div[2]/section[1]/div[2]/div/div[1]/div/div[2]/div/div[1]/form/div[2]/div/div/div/input")
password.send_keys("pass")
time.sleep(0.5)
password.send_keys(Keys.ENTER)
counter = 0
def init_movie():
time.sleep(3)
Flow = driver.find_element_by_xpath("/html/body/div[1]/div/div/div/div[3]/div/div[2]/div[1]/div/div[2]/ul/li[1]/div[2]/div[2]/strong")
Flow2 = driver.find_element_by_xpath("/html/body/div[1]/div/div/div/div[3]/div/div[2]/div[1]/div/div[2]/ul/li[2]/div[2]/div[2]/strong")
Flow = str(Flow.text)
Flow2 = str(Flow2.text)
Flow = int(Flow)
Flow2 = int(Flow2)
print("flow1 = " + str(Flow))
print("flow2 = " + str(Flow2))
if Flow >= 200:
if Flow2 >= 200:
pyautogui.click(x=825,y=550)
time.sleep(2)
x = randint(1,2)
if x == 1:
pyautogui.click(x=750, y=450)
if x == 2:
pyautogui.click(x=750,y=480)
time.sleep(10)
print("3")
else:
pyautogui.click(x=600, y=590)
time.sleep(2)
x = randint(1,2)
if x == 1:
pyautogui.click(x=520, y=450)
if x == 2:
pyautogui.click(x=515,y=500)
time.sleep(10)
print("2 is available")
else:
pyautogui.click(x=380, y=550)
time.sleep(2)
x = randint(1,2)
if x == 1:
pyautogui.click(x=290, y=450)
if x == 2:
pyautogui.click(x=290, y=500)
time.sleep(10)
print("1 available")
time.sleep(5)
init_movie()
while True:
#initialize movie
time.sleep(10)
prevFlow = driver.find_element_by_xpath("/html/body/div[1]/div/div/div/div[1]/div/div[2]/div[2]/span")
prevFlow = prevFlow.text
prevFlow = int(prevFlow.replace(',',''))
#-------------------check for all reactions--------------------
#check for hot-or-not
if (check_xpath("/html/body/div[1]/div/div/div/div[3]/div/div[2]/div[1]/div/div/div[2]/div[2]/div[2]/div[1]/div[2]/div[1]")) == True:
hot = driver.find_element_by_xpath("/html/body/div[1]/div/div/div/div[3]/div/div[2]/div[1]/div/div/div[2]/div[2]/div[2]/div[1]/div[2]/div[1]").click()
#check emoji
if (check_xpath("/html/body/div[1]/div/div/div/div[3]/div/div[2]/div[1]/div/div/div[2]/div[2]/div[2]/div[1]/div[2]/div/div[5]/div/div")) == True:
emoji = driver.find_element_by_xpath("/html/body/div[1]/div/div/div/div[3]/div/div[2]/div[1]/div/div/div[2]/div[2]/div[2]/div[1]/div[2]/div/div[5]/div/div").click()
#love it
if (check_xpath("/html/body/div[1]/div/div/div/div[3]/div/div[2]/div[1]/div/div/div[2]/div[2]/div[2]/div[1]/div[2]/div/div[2]/div/div[3]/div[1]")):
love_it = driver.find_element_by_xpath("/html/body/div[1]/div/div/div/div[3]/div/div[2]/div[1]/div/div/div[2]/div[2]/div[2]/div[1]/div[2]/div/div[2]/div/div[3]/div[1]").click()
#--------------------------------------------------------------
time.sleep(200)
if (check_xpath("/html/body/div[1]/div/div/div/div[3]/div/div[2]/div[1]/div/div/div[2]/div[1]/div[2]/div/div[2]/textarea")) == True:
skip = driver.find_element_by_xpath("/html/body/div[1]/div/div/div/div[3]/div/div[2]/div[1]/div/div/div[2]/div[2]/div[2]/div[2]/span")
print("skipped")
demand = driver.find_element_by_xpath("/html/body/div[1]/div/div/div/div[3]/div/div[2]/div[1]/div/div/div[1]/div[1]/div/div[1]/div/div[2]/div[3]/div/button[1]").click()
time.sleep(1)
demand2 = driver.find_element_by_xpath("/html/body/div[4]/div/div/div/div/div[2]/div[2]/div[11]").click()
time.sleep(1)
demand3 = driver.find_element_by_xpath("/html/body/div[4]/div/div/div/button/span").click()
time.sleep(1)
tag = driver.find_element_by_xpath("/html/body/div[1]/div/div/div/div[3]/div/div[2]/div[1]/div/div/div[1]/div[1]/div/div[1]/div/div[2]/div[3]/div/button[2]").click()
time.sleep(1)
tag2 = driver.find_element_by_xpath("/html/body/div[4]/div/div/div/div/div/div/div/div/div[3]/div[2]").click()
time.sleep(1)
exit2 = driver.find_element_by_xpath("/html/body/div[4]/div/div/div/button/span").click()
time.sleep(1)
rate = driver.find_element_by_xpath("/html/body/div[1]/div/div/div/div[3]/div/div[2]/div[1]/div/div/div[1]/div[1]/div/div[1]/div/div[2]/div[3]/div/button[3]").click()
time.sleep(1)
rate2 = driver.find_element_by_xpath("/html/body/div[4]/div/div/div/div/form/div[1]/textarea").send_keys("cool!")
time.sleep(1)
send = driver.find_element_by_xpath("/html/body/div[4]/div/div/div/div/form/div[3]/button").click()
time.sleep(1)
rate = driver.find_element_by_xpath("/html/body/div[1]/div/div/div/div[3]/div/div[2]/div[1]/div/div/div[1]/div[1]/div/div[2]/div[2]/div/div[1]/div[4]").click()
time.sleep(2)
newFlow = driver.find_element_by_xpath("/html/body/div[1]/div/div/div/div[1]/div/div[2]/div[2]/span")
newFlow = newFlow.text
newFlow = int(newFlow.replace(',',''))
y = newFlow - prevFlow
prevFlow = newFlow
print("Current Flow = " + str(newFlow) + ". You gained " + str(y) + " flow.")
counter += 1
if (check_xpath("/html/body/div[1]/div/div/div/div[3]/div/div[2]/div[1]/div/div/div[1]/div[2]/a[1]")) == True:
next_round = driver.find_element_by_xpath("/html/body/div[1]/div/div/div/div[3]/div/div[2]/div[1]/div/div/div[1]/div[2]/a[1]").click()
time.sleep(5)
elif (check_xpath("/html/body/div[1]/div/div/div/div[3]/div/div[2]/div[1]/div/div/div[1]/div[2]/a[2]")) == True:
next_vid = driver.find_element_by_xpath("/html/body/div[1]/div/div/div/div[3]/div/div[2]/div[1]/div/div/div[1]/div[2]/a[2]")
else:
next = driver.find_element_by_xpath("/html/body/div[1]/div/div/div/div[1]/div/ul/li[1]/a").click()
time.sleep(2)
init_movie()