forked from Devilstore/Gladoscheckin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
checkin.py
88 lines (77 loc) · 3.6 KB
/
checkin.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
import requests
import json
import os
# -------------------------------------------------------------------------------------------
# github workflows
# -------------------------------------------------------------------------------------------
if __name__ == '__main__':
# pushplus秘钥 申请地址 http://www.pushplus.plus
sckey = os.environ.get("PUSHPLUS", "")
# 推送内容
title = ""
success, fail, repeats = 0, 0, 0 # 成功账号数量 失败账号数量 重复签到账号数量
sendContent = ""
# glados账号cookie 直接使用数组 如果使用环境变量需要字符串分割一下
cookies = os.environ.get("COOKIES", []).split("&")
if cookies[0] == "":
print('未获取到COOKIE变量')
cookies = []
exit(0)
url = "https://glados.rocks/api/user/checkin"
url2 = "https://glados.rocks/api/user/status"
referer = 'https://glados.rocks/console/checkin'
origin = "https://glados.rocks"
useragent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36"
payload = {
'token': 'glados.one'
}
for cookie in cookies:
checkin = requests.post(url, headers={'cookie': cookie, 'referer': referer, 'origin': origin,
'user-agent': useragent, 'content-type': 'application/json;charset=UTF-8'}, data=json.dumps(payload))
state = requests.get(url2, headers={
'cookie': cookie, 'referer': referer, 'origin': origin, 'user-agent': useragent})
# --------------------------------------------------------------------------------------------------------#
if checkin.status_code == 200:
# 解析返回的json数据
result = checkin.json()
# 获取签到结果
status = result.get('message')
# 获取账号当前状态
result = state.json()
# 获取剩余时间
leftdays = int(float(result['data']['leftDays']))
# 获取账号email
email = result['data']['email']
print(status)
if "Checkin!" in status:
success += 1
message_status = "签到成功,会员天数 + 1"
elif status == "Checkin Repeats! Please Try Tomorrow":
message_status = "今日已签到"
else:
fail += 1
message_status = "签到失败,请检查..."
if leftdays is not None:
message_days = f"{leftdays} 天"
else:
message_days = "无法获取剩余天数信息"
else:
email = ""
message_status = "签到请求url失败, 请检查..."
message_days = "获取信息失败"
# 推送内容
sendContent += f"{status}\n\
{'-'*30}\n\
账号: {email}\n\
签到情况: {message_status}\n\
status字段: {status}\n\
剩余天数: {message_days}\n"
if cookie == cookies[-1]:
sendContent += '-' * 30
# --------------------------------------------------------------------------------------------------------#
print("sendContent:" + "\n", sendContent)
if sckey != "":
title += f'成功{success},失败{fail},重复{repeats}'
plusurl = f"http://www.pushplus.plus/send?token={sckey}&title={title}&content={sendContent}"
r = requests.get(plusurl)
print(r.status_code)