|
|
|
@ -192,6 +192,40 @@ function getSubtitle(share_id,sub_file_id,share_pwd){ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function aliMyPlayUrl(file_id) { |
|
|
|
|
function aliMyOpenPlayUrl(file_id) { |
|
|
|
|
try { |
|
|
|
|
function getopentoken(token) { |
|
|
|
|
let authorization = 'Bearer ' + token; |
|
|
|
|
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 code = json.redirectUri.split("code=")[1]; |
|
|
|
|
let data2 = {"code":code,"grant_type":"authorization_code"} |
|
|
|
|
let json2 = JSON.parse(request('https://api.nn.ci/alist/ali_open/code', { body: data2, method: 'POST', timeout: 3000 })); |
|
|
|
|
return json2.access_token || ""; |
|
|
|
|
} |
|
|
|
|
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(userinfo.access_token); |
|
|
|
|
putMyVar('aliopeninfo', opentoken); |
|
|
|
|
putMyVar('opentokenChecktime', nowtime + 'time'); |
|
|
|
|
} |
|
|
|
|
let drive_id = userinfo.default_drive_id; |
|
|
|
|
headers['authorization'] = 'Bearer ' + opentoken; |
|
|
|
|
let data3 = {"drive_id":drive_id,"file_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 })); |
|
|
|
|
return json3.url || ""; |
|
|
|
|
} catch (e) { |
|
|
|
|
log('获取我的云盘开放原始播放地址失败>' + e.message); |
|
|
|
|
} |
|
|
|
|
return ""; |
|
|
|
|
} |
|
|
|
|
try { |
|
|
|
|
let authorization = 'Bearer ' + userinfo.access_token; |
|
|
|
|
let deviceId = userinfo.device_id; |
|
|
|
@ -220,6 +254,14 @@ function aliMyPlayUrl(file_id) { |
|
|
|
|
} else { |
|
|
|
|
log('未获取阿里转码播放地址,建议重进软件再试一次') |
|
|
|
|
} |
|
|
|
|
let file_url = aliMyOpenPlayUrl(file_id); |
|
|
|
|
if(file_url){ |
|
|
|
|
urls.unshift(file_url+ "#isVideo=true##pre#"); |
|
|
|
|
names.unshift("原始 画质"); |
|
|
|
|
heads.unshift({'Referer':'https://www.aliyundrive.com/'}); |
|
|
|
|
}else{ |
|
|
|
|
clearMyVar('aliopeninfo'); |
|
|
|
|
} |
|
|
|
|
return { |
|
|
|
|
urls: urls, |
|
|
|
|
names: names, |
|
|
|
|