This repository has been archived by the owner on Nov 25, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathck_everphoto.py
55 lines (45 loc) · 1.58 KB
/
ck_everphoto.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
# -*- coding: utf-8 -*-
"""
:author @CAB233
:url https://github.com/CAB233/everphoto_checkin
cron: 3 22 * * *
new Env('时光相册');
"""
import json
import requests
from notify_mtr import send
from utils import get_data
class EverPhoto:
def __init__(self, check_items):
self.check_items = check_items
def main(self):
msg_all = ""
for check_item in self.check_items:
mobile = check_item.get("mobile")
password = check_item.get("password")
header = {}
url = "https://api.everphoto.cn/users/self/checkin/v2"
login_url = "https://web.everphoto.cn/api/auth"
login_key = f"mobile={mobile}&password={password}"
login_res = requests.post(login_url, data=login_key, headers=header)
login_data = json.loads(login_res.text)["data"]
header["authorization"] = "Bearer "+login_data["token"]
response = requests.post(url, headers=header)
data = json.loads(response.text)
checkin_result = data["data"]["checkin_result"]
continuity = data["data"]["continuity"]
msg = (
"是否为今日第一次签到:"
+ str(checkin_result)
+ "\n"
+ "累积签到天数:"
+ str(continuity)
)
msg_all += msg + "\n\n"
return msg_all
if __name__ == "__main__":
data = get_data()
_check_items = data.get("EVERPHOTO", [])
res = EverPhoto(check_items=_check_items).main()
print(res)
send("时光相册", res)