本帖最后由 cn流星 于 2021-2-12 12:23 编辑
2021-2-12更新:
修正了79行的一个错误,谢谢提醒
看到很多留言需要,在此奉上github actiong食用脚本:
https://github.com/luck-ying02/youdaoyunnote_sign
之前看到我上一个帖子有需要有道云笔记签到的,过年有空就写一写
因为懒得自己去抓包分析api了就直接参考了某个大佬的:https://github.com/QikaiXu/YoudaoNote-checkin
直接新建腾讯云函数 复制上去就能使用了,
不知道大家需不需要github action的,需要的留言,到时候附上github地址
代码:
[Asm] 纯文本查看 复制代码 import requests
import json
import time
import os
import hashlib
from requests.packages.urllib3.exceptions import InsecureRequestWarning
# 禁用安全请求警告
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
# 配置各种key
# Server酱申请的skey
SCKEY = ''
# 钉钉机器人的 webhook
webhook = ''
# 配置通知方式 0=dingding 1=weixin 2=全都要 其他为不推送
notice = ''
#账号
username = ''
#密码
password = ''
global contents
contents = ''
#输出方式
def output(content):
global contents
content += ' '
# 整合输出内容
contents += content + '\n'
content += ' '
print(content)
#server酱推送
def server():
global contents
message = {"text": "有道云笔记签到通知!", "desp": contents}
r = requests.post("https://sc.ftqq.com/" + SCKEY + ".send", data=message)
if r.status_code == 200:
print('[+]server酱已推送,请查收')
#钉钉消息推送
def dingtalk():
webhook_url = webhook
dd_header = {"Content-Type": "application/json", "Charset": "UTF-8"}
global contents
dd_message = {
"msgtype": "text",
"text": {
"content": f'有道云笔记签到通知!\n{contents}'
}
}
r = requests.post(url=webhook_url,
headers=dd_header,
data=json.dumps(dd_message))
if r.status_code == 200:
print('[+]钉钉消息已推送,请查收 ')
def sign():
login_url = 'https://note.youdao.com/login/acc/urs/verify/check?app=web&product=YNOTE&tp=urstoken&cf=6&fr=1&systemName=&deviceType=&ru=https%3A%2F%2Fnote.youdao.com%2FsignIn%2F%2FloginCallback.html&er=https%3A%2F%2Fnote.youdao.com%2FsignIn%2F%2FloginCallback.html&vcode=&systemName=mac&deviceType=MacPC×tamp=1611466345699'
parame = {
'username': username,
'password': hashlib.md5(password.encode('utf8')).hexdigest(),
}
session = requests.session()
# 登录
session.post(url=login_url, data=parame, verify=False)
checkin_url = 'http://note.youdao.com/yws/mapi/user?method=checkin'
# 签到
response = session.post(url=checkin_url)
if response.status_code == 200:
# 格式话
info = json.loads(response.text)
# 一共签到获得
total = info['total'] / 1048576
# 本次签到获得空间
space = info['space'] / 1048576
# 当前时间
times = time.strftime('%Y-%m-%d %H:%M:%S',
time.localtime(info['time'] / 1000))
output('[+]用户: ' + username + ' 签到成功!')
output('[+]当前签到时间:' + times)
output('[+]签到获得:' + str(space) + 'MB')
output('[+]总共获得:' + str(total) + 'MB')
def main():
output('---开始【有道云笔记每日签到】---')
sign()
output('---结束【有道云笔记每日签到】---')
if notice == '0':
try:
dingtalk()
except Exception:
print('[+]请检查钉钉配置是否正确')
elif notice == '1':
try:
server()
except Exception:
print('[+]请检查server酱配置是否正确')
elif notice == '2':
try:
dingtalk()
except Exception:
print('[+]请检查钉钉配置是否正确')
try:
server()
except Exception:
print('[+]请检查server酱配置是否正确')
else:
print('[+]选择不推送信息')
def main_handler(event, context):
return main()
if __name__ == '__main__':
main()
效果图:
支持 serveer酱和钉钉推送,或者不选 |