@@ -18,10 +18,8 @@ def parseCode(inputList):
18
18
def getGarenaComment (rootID = 0 ,num = 5 ):
19
19
url = "https://commenttw.garenanow.com/api/comments/get/"
20
20
header = {'User-Agent' : 'Garenagxx/2.0.1909.2618 (Intel x86_64; zh-Hant; TW)' ,"Content-Type" : 'application/json' }
21
- news = ["32165" , "32164" ,"32159" ] # "32153"
21
+ news = ["32165" ] # "32164", "32159", "32153"
22
22
data = {"obj_id" : "tw_32775_newnews_{}" .format (random .choice (news )),
23
- #"obj_id": "tw_32775_newnews_32164",
24
- #"obj_id": "tw_32775_newnews_32159",
25
23
"root_id" : 0 ,
26
24
"size" : num , #留言數量
27
25
"replies" : 10 ,
@@ -89,9 +87,9 @@ def getPosConfirm():
89
87
print ("已獲取輸入框位置: {}" .format (posInbox ))
90
88
return posInbox
91
89
def confirmObject (errPrint = True ,errNum = 5 ):
92
- posConfirm = None
93
- errSubmit = 0
94
90
for i in range (2 ):
91
+ posConfirm = None
92
+ errSubmit = 0
95
93
while posConfirm is None and errSubmit < errNum :
96
94
checkKeyEnd ()
97
95
posConfirm = pyautogui .locateCenterOnScreen ('imgs/confirm.png' , confidence = 0.8 )
@@ -101,7 +99,7 @@ def confirmObject(errPrint=True,errNum=5):
101
99
print ("出現異常,無法跳出確認視窗" )
102
100
break
103
101
pyautogui .click (posConfirm )
104
- time .sleep (0.3 )
102
+ time .sleep (0.2 )
105
103
106
104
def balloonExchange ():
107
105
posExArea = pyautogui .locateCenterOnScreen ('./imgs/exArea.png' ) #Exchange Area
@@ -153,21 +151,7 @@ def checkFinish():
153
151
#pyautogui.write(code)
154
152
pyautogui .hotkey ('ctrl' , 'v' )
155
153
pyautogui .click (posSubmit )
156
- errSubmit = 0
157
- for i in range (2 ):
158
- ok_position = pyautogui .locateCenterOnScreen ('imgs/confirm.png' , confidence = 0.8 )
159
- while ok_position is None and errSubmit < 5 :
160
- checkKeyEnd ()
161
- ok_position = pyautogui .locateCenterOnScreen ('imgs/confirm.png' , confidence = 0.8 )
162
- #print(f'正在擷取「確定」位置:{ok_position}')
163
- errSubmit += 1
164
- time .sleep (0.15 )
165
- if errSubmit >= 5 :
166
- break
167
- pyautogui .click (ok_position )
168
- time .sleep (0.1 )
169
- if errSubmit >= 5 :
170
- print (f'輸入序號時出現異常,無法跳出確認視窗' )
154
+ confirmObject (errNum = 5 )
171
155
count = count + 1
172
156
time .sleep (0.1 )
173
157
if keyboard .is_pressed ('p' ): #Paused
0 commit comments