diff --git a/SrcJyAliPublic.js b/SrcJyAliPublic.js index 57e1484..c5557ea 100644 --- a/SrcJyAliPublic.js +++ b/SrcJyAliPublic.js @@ -150,7 +150,7 @@ function getAliUrl(share_id, file_id, share_pwd) { if (getItem('aliyun_playMode', '智能') == "智能" || getItem('aliyun_playMode') == "原画") { let openUrl = aliOpenPlayUrl(file_id, { sharetoken: sharetoken, share_id: share_id }); if (openUrl) { - urls.push(openUrl + "#isVideo=true##pre#" + getItem('fastPlayMode')=="1"?"#fastPlayMode##threads=10#":""); + urls.push(openUrl + "#isVideo=true##pre#" + (getItem('fastPlayMode')=="1"?"#fastPlayMode##threads=10#":"")); names.push("原始 画质"); heads.push({ 'Referer': 'https://www.aliyundrive.com/' }); } else { @@ -174,7 +174,7 @@ function getAliUrl(share_id, file_id, share_pwd) { playUrlList.reverse(); playUrlList.forEach((item) => { if(item.url){ - urls.push(item.url + "#isVideo=true##pre#" + getItem('fastPlayMode')=="1"?"#fastPlayMode##threads=10#":""); + urls.push(item.url + "#isVideo=true##pre#" + (getItem('fastPlayMode')=="1"?"#fastPlayMode##threads=10#":"")); names.push(transcoding[item.template_id] ? transcoding[item.template_id] : item.template_height); heads.push({ 'Referer': 'https://www.aliyundrive.com/' }); } @@ -231,9 +231,10 @@ function aliMyPlayUrl(file_id, drive_id) { let names = []; let heads = []; if (aliyunUrl.length > 0) { + log(aliyunUrl); aliyunUrl.forEach((item) => { if(item.url){ - urls.push(item.url + "#isVideo=true##pre#" + getItem('fastPlayMode')=="1"?"#fastPlayMode##threads=10#":""); + urls.push(item.url + "#isVideo=true##pre#" + (getItem('fastPlayMode')=="1"?"#fastPlayMode##threads=10#":"")); names.push(transcoding[item.template_id] ? transcoding[item.template_id] : item.template_height); heads.push({ 'Referer': 'https://www.aliyundrive.com/' }); } @@ -250,7 +251,7 @@ function aliMyPlayUrl(file_id, drive_id) { fetch('https://openapi.aliyundrive.com/adrive/v1.0/openFile/video/updateRecord', { headers: headers, body: { "duration": "0", "drive_id": drive_id, "file_id": file_id, "play_cursor": "0" }, method: 'POST' }); } - urls.unshift(file_url + "#isVideo=true##pre#" + getItem('fastPlayMode')=="1"?"#fastPlayMode##threads=10#":""); + urls.unshift(file_url + "#isVideo=true##pre#" + (getItem('fastPlayMode')=="1"?"#fastPlayMode##threads=10#":"")); names.unshift("原始 画质"); heads.unshift({ 'Referer': 'https://www.aliyundrive.com/' }); } else { @@ -369,7 +370,7 @@ function getOpenToken(authorization) { } function tvOpenApi(refresh_token) { let variable; - let data = {}; + let data; if (refresh_token) { data = { grant_type: "refresh_token", @@ -392,21 +393,24 @@ function getOpenToken(authorization) { body: { "authorize": 1, "scopes": ["user:base", "file:all:read", "file:all:write"], + //"drives": ["backup", "resource"], "sid": sid }, method: 'POST', timeout: 8000 })); - log(json); + //log(json); if(json.result){ let code = JSON.parse(request("https://openapi.aliyundrive.com/oauth/qrcode/" + sid + "/status")).authCode; data = { "code": code, "grant_type": "authorization_code" } } - log(data); variable = 0; } + let json2 = {}; - json2 = JSON.parse(request('http://api.extscreen.com/aliyundrive/token', { body: data, method: 'POST', timeout: 8000 })).data; + if(data){ + json2 = JSON.parse(request('http://api.extscreen.com/aliyundrive/token', { body: data, method: 'POST', timeout: 8000 })).data || {}; + } json2.variable = variable; return json2; }