更新 'SrcJyAliPublic.js'

main
src48597962 2 years ago
parent 1ac48c10ae
commit 4ee7d32026
  1. 50
      SrcJyAliPublic.js

@ -255,18 +255,18 @@ function aliOpenPlayUrl(file_id,sharedata) {
headers['authorization'] = authorization;
headers['x-canary'] = "client=web,app=adrive,version=v4.3.1";
let data = {"authorize":"1","scope":"user:base,file:all:read,file:all:write"}
let json = JSON.parse(request('https://open.aliyundrive.com/oauth/users/authorize?client_id=76917ccccd4441c39457a04f6084fb2f&redirect_uri=https://alist.nn.ci/tool/aliyundrive/callback&scope=user:base,file:all:read,file:all:write&state=', { headers: headers, body: data, method: 'POST', timeout: 3000 }));
let json = JSON.parse(request('https://open.aliyundrive.com/oauth/users/authorize?client_id=76917ccccd4441c39457a04f6084fb2f&redirect_uri=https://alist.nn.ci/tool/aliyundrive/callback&scope=user:base,file:all:read,file:all:write&state=', { headers: headers, body: data, method: 'POST', timeout: 8000 }));
let code = json.redirectUri.split("code=")[1];
let data2 = {"code":code,"grant_type":"authorization_code"}
let json2;
try{
json2 = JSON.parse(request('https://api-cf.nn.ci/alist/ali_open/code', { body: data2, method: 'POST', timeout: 3000 }));
json2 = JSON.parse(request('https://api-cf.nn.ci/alist/ali_open/code', { body: data2, method: 'POST', timeout: 8000 }));
} catch(e) {
json2 = JSON.parse(request('https://api.xhofe.top/alist/ali_open/code', { body: data2, method: 'POST', timeout: 3000 }));
json2 = JSON.parse(request('https://api.xhofe.top/alist/ali_open/code', { body: data2, method: 'POST', timeout: 8000 }));
}
return json2.access_token || "";
}
function copy(obj) {
function fcopy(obj) {
try {
let json = JSON.parse(fetch('https://api.aliyundrive.com/adrive/v2/batch', {
headers: {
@ -299,7 +299,7 @@ function aliOpenPlayUrl(file_id,sharedata) {
return "";
}
};
function del(obj) {
function fdel(obj) {
fetch('https://api.aliyundrive.com/adrive/v2/batch', {
headers: {
'User-Agent': PC_UA,
@ -331,32 +331,38 @@ function aliOpenPlayUrl(file_id,sharedata) {
sharedata.file_id = file_id;
sharedata.drive_id = drive_id;
sharedata.authorization = authorization;
newfile_id = copy(sharedata);
newfile_id = fcopy(sharedata);
if(!newfile_id){
return "";
}
}
let opentoken;
let nowtime = Date.now();
let oldtime = parseInt(getMyVar('opentokenChecktime', '0').replace('time', ''));
let aliopentoken = getMyVar('aliopentoken');
if (aliopentoken && nowtime < (oldtime + 1 * 60 * 60 * 1000)) {
opentoken = aliopentoken;
} else {
opentoken = getopentoken(authorization);
putMyVar('aliopeninfo', opentoken);
putMyVar('opentokenChecktime', nowtime + 'time');
let url = '';
try{
let opentoken;
let nowtime = Date.now();
let oldtime = parseInt(getMyVar('opentokenChecktime', '0').replace('time', ''));
let aliopentoken = getMyVar('aliopentoken');
if (aliopentoken && nowtime < (oldtime + 1 * 60 * 60 * 1000)) {
opentoken = aliopentoken;
} else {
opentoken = getopentoken(authorization);
putMyVar('aliopeninfo', opentoken);
putMyVar('opentokenChecktime', nowtime + 'time');
}
headers['authorization'] = 'Bearer ' + opentoken;
let data3 = {"drive_id":drive_id,"file_id":newfile_id||file_id}
let json3 = JSON.parse(request('https://open.aliyundrive.com/adrive/v1.0/openFile/getDownloadUrl', { headers: headers, body: data3, method: 'POST', timeout: 8000}));
url = json3.url;
}catch(e){
log('获取原画播放地址失败>' + e.message);
}
headers['authorization'] = 'Bearer ' + opentoken;
let data3 = {"drive_id":drive_id,"file_id":newfile_id||file_id}
let json3 = JSON.parse(request('https://open.aliyundrive.com/adrive/v1.0/openFile/getDownloadUrl', { headers: headers, body: data3, method: 'POST', timeout: 3000 }));
if (newfile_id) {
sharedata.file_id = newfile_id;
del(sharedata);
fdel(sharedata);
}
return json3.url || "";
return url;
} catch (e) {
log('获取我的云盘开放原画播放地址失败>' + e.message);
log('获取我的云盘原画出现异常>' + e.message);
}
return "";
}
Loading…
Cancel
Save