mirror of
https://github.com/Sitoi/dailycheckin.git
synced 2024-11-17 21:58:03 +08:00
🔨 增强【有道云笔记】cookie 时长,待测试
This commit is contained in:
parent
b2f023f3e7
commit
6181f97dbb
@ -1,7 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
|
||||
import requests
|
||||
|
||||
@ -11,17 +10,19 @@ class YouDaoCheckIn:
|
||||
self.check_item = check_item
|
||||
|
||||
@staticmethod
|
||||
def sign(headers):
|
||||
def sign(cookies):
|
||||
ad_space = 0
|
||||
refresh_cookies_res = requests.get("http://note.youdao.com/login/acc/pe/getsess?product=YNOTE", cookies=cookies)
|
||||
cookies = dict(refresh_cookies_res.cookies)
|
||||
url = "https://note.youdao.com/yws/api/daupromotion?method=sync"
|
||||
res = requests.post(url=url, headers=headers)
|
||||
res = requests.post(url=url, cookies=cookies)
|
||||
if "error" not in res.text:
|
||||
checkin_response = requests.post(
|
||||
url="https://note.youdao.com/yws/mapi/user?method=checkin", headers=headers
|
||||
url="https://note.youdao.com/yws/mapi/user?method=checkin", cookies=cookies
|
||||
)
|
||||
for i in range(3):
|
||||
ad_response = requests.post(
|
||||
url="https://note.youdao.com/yws/mapi/user?method=adRandomPrompt", headers=headers
|
||||
url="https://note.youdao.com/yws/mapi/user?method=adRandomPrompt", cookies=cookies
|
||||
)
|
||||
ad_space += ad_response.json()["space"] // 1048576
|
||||
if "reward" in res.text:
|
||||
@ -36,11 +37,16 @@ class YouDaoCheckIn:
|
||||
return youdao_message
|
||||
|
||||
def main(self):
|
||||
youdao_cookie = self.check_item.get("youdao_cookie")
|
||||
ynote_pers = re.findall(r"YNOTE_PERS=(.*?);", youdao_cookie)[0]
|
||||
uid = ynote_pers.split("||")[-2]
|
||||
headers = {"Cookie": youdao_cookie}
|
||||
msg = self.sign(headers=headers)
|
||||
youdao_cookie = {
|
||||
item.split("=")[0]: item.split("=")[1] for item in self.check_item.get("youdao_cookie").split("; ")
|
||||
}
|
||||
try:
|
||||
ynote_pers = youdao_cookie.get("YNOTE_PERS", "")
|
||||
uid = ynote_pers.split("||")[-2]
|
||||
except Exception as e:
|
||||
print(f"获取用户信息失败: {e}")
|
||||
uid = "未获取到用户信息"
|
||||
msg = self.sign(cookies=youdao_cookie)
|
||||
msg = f"帐号信息: {uid}\n获取空间: {msg}"
|
||||
return msg
|
||||
|
||||
@ -50,5 +56,5 @@ if __name__ == "__main__":
|
||||
os.path.join(os.path.dirname(os.path.dirname(__file__)), "config/config.json"), "r", encoding="utf-8"
|
||||
) as f:
|
||||
datas = json.loads(f.read())
|
||||
_check_item = datas.get("YOUDAO_COOKIE_LIST", [])
|
||||
YouDaoCheckIn(check_item=_check_item).main()
|
||||
_check_item = datas.get("YOUDAO_COOKIE_LIST", [])[0]
|
||||
print(YouDaoCheckIn(check_item=_check_item).main())
|
||||
|
Loading…
Reference in New Issue
Block a user