第一步,在电脑上获取token的办法。
打开阿里云盘网页版,打开控制台输入 JSON.parse(localStorage.getItem('token')).refresh_token 回车
第二步,在青龙面板-脚本管理-新建脚本,名称比如aliyun.py,进入编辑模式粘贴以下代码
[Python] 纯文本查看 复制代码 import requests
import json
def AliyunDrive(token):
# 'JSON.parse(localStorage.getItem('token')).refresh_token'
header = {
'Content-Type': "application/json",
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 Edg/96.0.1054.62'
}
url_page = 'https://auth.aliyundrive.com/v2/account/token'
date={'grant_type': 'refresh_token', "refresh_token": token}
rep = requests.post(url=url_page, headers=header,
data=json.dumps(date)).content
print('阿里云盘签到token:'+token)
result = json.loads(rep)
access_token = result['access_token']
phone = result['user_name']
import requests
import json
def AliyunDrive(token):
# 'JSON.parse(localStorage.getItem('token')).refresh_token'
header = {
'Content-Type': "application/json",
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 Edg/96.0.1054.62'
}
url_page = 'https://auth.aliyundrive.com/v2/account/token'
date={'grant_type': 'refresh_token', "refresh_token": token}
rep = requests.post(url=url_page, headers=header,
data=json.dumps(date)).content
print('阿里云盘签到token:'+token)
result = json.loads(rep)
access_token = result['access_token']
phone = result['user_name']
print('阿里云盘签到access_token:'+access_token)
access_token2 = 'Bearer ' + access_token
header2 = {
'Authorization' : access_token2,
'Content-Type': "application/json",
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 Edg/96.0.1054.62'
}
date={"_rx-s": "mobile"}
url_page = 'https://member.aliyundrive.com/v1/activity/sign_in_list'
rep2 = requests.post(url=url_page, headers=header2,
data=json.dumps(date)).content
result = json.loads(rep2)
signInCount = result['result']['signInCount']
print(signInCount)
print('阿里云盘签到天数:' + str(signInCount)+"天")
date={"signInDay": signInCount}
url_page = 'https://member.aliyundrive.com/v1/activity/sign_in_reward?_rx-s=mobile'
rep3 = requests.post(url=url_page, headers=header2,
data=json.dumps(date)).content
result = json.loads(rep3)
name = result["result"]["name"]
description=result["result"]["description"]
res="签到成功, 本月累计签到" +str(signInCount) + "天"
res2="本次签到获得"+result["result"]["name"] +","+result["result"]["description"]
print(res+"\n"+res2)
return (res+"\n"+res2)
token=第一步的token
AliyunDrive(token)
第三步,青龙面板-定时任务-新建任务
名称aliyun,命令 task aliyun.py 定时规则 0 10 08 ? * *(按需要修改)
|