From fd21c7068e36cd07cecf198626cd5770367969d6 Mon Sep 17 00:00:00 2001 From: src48597962 <48597962@qq.com> Date: Sun, 10 Dec 2023 21:18:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20'SrcJyAliPublic.js'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SrcJyAliPublic.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/SrcJyAliPublic.js b/SrcJyAliPublic.js index bd8be0e..6673f46 100644 --- a/SrcJyAliPublic.js +++ b/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 }