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

Loading…
Cancel
Save