更新 'SrcJyAliPublic.js'

main
src48597962 1 year ago
parent 8e3319b499
commit fd21c7068e
  1. 10
      SrcJyAliPublic.js

@ -236,7 +236,7 @@ function aliMyPlayUrl(file_id) {
names.unshift("原始 画质");
heads.unshift({ 'Referer': 'https://www.aliyundrive.com/' });
} else {
clearMyVar('aliopeninfo');
clearMyVar('opentokenChecktime');
}
return {
urls: urls,
@ -251,6 +251,8 @@ function aliMyPlayUrl(file_id) {
function aliOpenPlayUrl(file_id, sharedata) {
try {
let nowtime = Date.now();
function getOpenToken(authorization) {
headers['authorization'] = authorization;
headers['x-canary'] = "client=web,app=adrive,version=v4.3.1";
@ -268,6 +270,9 @@ function aliOpenPlayUrl(file_id, sharedata) {
} catch (e) {
json2 = JSON.parse(request('https://api.xhofe.top/alist/ali_open/code', { body: data2, method: 'POST', timeout: 8000 }));
}
putMyVar('aliopentoken', json2.access_token);
putMyVar('opentokenChecktime', nowtime + 'time');
return json2.access_token || "";
}
function fcopy(obj) {
@ -345,15 +350,12 @@ function aliOpenPlayUrl(file_id, sharedata) {
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 + 2 * 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 }

Loading…
Cancel
Save