-
Notifications
You must be signed in to change notification settings - Fork 232
/
main.py
62 lines (56 loc) · 2.23 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
import requests, json, re, os
session = requests.session()
# 配置用户名(一般是邮箱)
# email = os.environ.get('EMAIL')
# 配置用户名对应的密码 和上面的email对应上
# passwd = os.environ.get('PASSWD')
# 从设置的环境变量中的Variables多个邮箱和密码 ,分割
emails = os.environ.get('EMAIL', '').split(',')
passwords = os.environ.get('PASSWD', '').split(',')
# server酱
SCKEY = os.environ.get('SCKEY')
# PUSHPLUS
Token = os.environ.get('TOKEN')
def push(content):
if SCKEY != '1':
url = "https://sctapi.ftqq.com/{}.send?title={}&desp={}".format(SCKEY, 'ikuuu签到', content)
requests.post(url)
print('推送完成')
elif Token != '1':
headers = {'Content-Type': 'application/json'}
json = {"token": Token, 'title': 'ikuuu签到', 'content': content, "template": "json"}
resp = requests.post(f'http://www.pushplus.plus/send', json=json, headers=headers).json()
print('push+推送成功' if resp['code'] == 200 else 'push+推送失败')
else:
print('未使用消息推送推送!')
# 会不定时更新域名,记得Sync fork
login_url = 'https://ikuuu.pw/auth/login'
check_url = 'https://ikuuu.pw/user/checkin'
info_url = 'https://ikuuu.pw/user/profile'
header = {
'origin': 'https://ikuuu.pw',
'user-agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36'
}
for email, passwd in zip(emails, passwords):
session = requests.session()
data = {
'email': email,
'passwd': passwd
}
try:
print(f'[{email}] 进行登录...')
response = json.loads(session.post(url=login_url,headers=header,data=data).text)
print(response['msg'])
# 获取账号名称
# info_html = session.get(url=info_url,headers=header).text
# info = "".join(re.findall('<span class="user-name text-bold-600">(.*?)</span>', info_html, re.S))
# 进行签到
result = json.loads(session.post(url=check_url,headers=header).text)
print(result['msg'])
content = result['msg']
# 进行推送
push(content)
except:
content = '签到失败'
print(content)
push(content)