更新 'SrcJyAliPublic.js'

main
src48597962 7 months ago
parent 83fea5f08f
commit e37543c7ec
  1. 81
      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#");
urls.push(openUrl + "#isVideo=true##pre#" + getItem('fastPlayMode')=="1"?"#fastPlayMode##threads=10#":"");
names.push("原始 画质");
heads.push({ 'Referer': 'https://www.aliyundrive.com/' });
} else {
@ -173,9 +173,11 @@ function getAliUrl(share_id, file_id, share_pwd) {
let playUrlList = aliOpenPlayUrl(file_id, { sharetoken: sharetoken, share_id: share_id }, '', 1) || [];
playUrlList.reverse();
playUrlList.forEach((item) => {
urls.push(item.url + "#isVideo=true##pre#");
if(item.url){
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/' });
}
})
}
return {
@ -230,9 +232,11 @@ function aliMyPlayUrl(file_id, drive_id) {
let heads = [];
if (aliyunUrl.length > 0) {
aliyunUrl.forEach((item) => {
urls.push(item.url + "#isVideo=true##pre#");
if(item.url){
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/' });
}
})
} else {
log('未获取阿里转码播放地址,建议重进软件再试一次')
@ -246,7 +250,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#");
urls.unshift(file_url + "#isVideo=true##pre#" + getItem('fastPlayMode')=="1"?"#fastPlayMode##threads=10#":"");
names.unshift("原始 画质");
heads.unshift({ 'Referer': 'https://www.aliyundrive.com/' });
} else {
@ -363,23 +367,70 @@ function getOpenToken(authorization) {
}
return json2;
}
function tvOpenApi(refresh_token) {
let variable;
let data = {};
if (refresh_token) {
data = {
grant_type: "refresh_token",
refresh_token: refresh_token
}
variable = 1;
} else {
let res = post("http://api.extscreen.com/aliyundrive/qrcode", {
body: JSON.stringify({
"scopes": 'user:base,file:all:read,file:all:write',
"width": 500,
"height": 500,
}),
});
let data = JSON.parse(res).data;
let sid = data["sid"];
let body = {
"authorize": 1,
"scope": "user:base,file:all:read,file:all:write",
"drives": ["backup", "resource"],
"scopes": ["user:base", "file:all:read", "file:all:write"],
"sid": sid
}
let json = JSON.parse(request('http://api.extscreen.com/aliyundrive/token', {
headers: headers,
body: body,
method: 'POST',
timeout: 8000
}));
log(json);
return json;
//let code = json.redirectUri.split("code=")[1];
//data = { "code": code, "grant_type": "authorization_code" }
variable = 0;
}
let json2 = {};
try {
json2 = JSON.parse(request('https://api.xhofe.top/alist/ali_open/code', { body: data, method: 'POST', timeout: 8000 }));
} catch (e) {
json2 = JSON.parse(request('https://api-cf.nn.ci/alist/ali_open/code', { body: data, method: 'POST', timeout: 8000 }));
}
json2.variable = variable;
return json2;
}
if (getItem('aliyun_openInt', '1') == '2') {
let alistOpen = webdavOpenApi(aliOpenTokenObj.refresh_token_2);
if (alistOpen.access_token) {
open_access_token = alistOpen.access_token;
aliOpenTokenObj.refresh_token_2 = alistOpen.refresh_token || "";
} else if (alistOpen.error) {
log('webdav开放接口获取token失败>' + alistOpen.error);
let openApi = webdavOpenApi(aliOpenTokenObj.refresh_token_2);
if (openApi.access_token) {
open_access_token = openApi.access_token;
aliOpenTokenObj.refresh_token_2 = openApi.refresh_token || "";
} else if (openApi.error) {
log('webdav开放接口获取token失败>' + openApi.error);
toast('原画接口2失败,重新登录或切换原画1或转码播放');
}
} else {
let alistOpen = alistOpenApi(aliOpenTokenObj.refresh_token_1);
if (alistOpen.error && alistOpen.variable) {
alistOpen = alistOpenApi();
let openApi = alistOpenApi(aliOpenTokenObj.refresh_token_1);
if (openApi.error && openApi.variable) {
openApi = alistOpenApi();
}
open_access_token = alistOpen.access_token;
aliOpenTokenObj.refresh_token_1 = alistOpen.refresh_token || "";
open_access_token = openApi.access_token;
aliOpenTokenObj.refresh_token_1 = openApi.refresh_token || "";
}
if (open_access_token) {
aliconfig.opentoken = aliOpenTokenObj;

Loading…
Cancel
Save