RT,提示:
Traceback (most recent call last):
File "<stdin>", line 9, in <module>
ValueError: invalid literal for int() with base 32: '\n'
代码(cookie已被更改):
import requests
import json
import time
headers={
"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36"
,"cookie":"X_CACHE_KEY=1ebaaf38a8bd6e85b36bca17d4f6735b; PHPSESSID=ur77ikbdudpgd8t9nlshioc7gq; clientID=015c434c9b5ec64b29f0ff218d1a7ed6"
}
headers2={
"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36"
,"cookie":"X_CACHE_KEY=39c72a2e8c64a7762323c8c1fa4de5f6; PHPSESSID=qqctur3i5jagid3thndnqpac8g; clientID=d21958ac51bcf7aca3ac543be22faae8"
}
with open("board.json","r") as load_f:
board = json.load(load_f) # 引入图画内容
def paint(x,y,c,cur): # 涂色函数
data={
'x':x,
'y':y,
'color':c,
} # data为我们需要填充的颜色和坐标
print(x,y,c)
if cur%2==1:
print(data,headers2)
response = requests.post("https://oj.hikari.owo.fit/paintBoard/paint",data=data,headers=headers2) # 填色
if cur%2==0:
print(data,headers)
response = requests.post("https://oj.hikari.owo.fit/paintBoard/paint",data=data,headers=headers) # 填色
time.sleep(3)
pause=3
mark=0
t0 = time.time()
while 1:
pboard = requests.get("https://oj.hikari.owo.fit/paintBoard/board",headers=headers)
d=[]
cnt=1
for point in board:
x=point[0]
y=point[1]
c=point[2]
if int(pboard.text[x*601+y],32) != c:
cnt=cnt+1
d.append(point)
cur=0
t = time.time()-t0
# print(t)
t0 = time.time()
for point in d:
x=point[0]
y=point[1]
c=point[2]
paint(x,y,c,cur)
cur=cur+1