更新 'SrcJyAlist.js'

master
src48597962 2 years ago
parent 9797d75cdb
commit 148a9563dd
  1. 188
      SrcJyAlist.js

@ -373,100 +373,20 @@ function alistUrl(alistapi,path,sign,subtitle,provider) {
} }
if(provider=="AliyundriveShare"){ if(provider=="AliyundriveShare"){
function getAliUrl(share_id,file_id,alitoken){ try{
try{ let redirect = JSON.parse(request(url,{onlyHeaders:true,redirect:false,timeout:3000}));
function getNowTime() { let rurl = redirect.headers.location[0];
const yy = new Date().getFullYear() let share_id = rurl.split('&sl=')[1].split('&')[0];
const MM = (new Date().getMonth() + 1) < 10 ? '0' + (new Date().getMonth() + 1) : (new Date().getMonth() + 1) let file_id = rurl.split('&f=')[1].split('&')[0];
const dd = new Date().getDate() < 10 ? '0' + new Date().getDate() : new Date().getDate() let alitoken = alistconfig.alitoken;
const HH = new Date().getHours() < 10 ? '0' + new Date().getHours() : new Date().getHours() let play = getAliUrl(share_id,file_id,alitoken);
const mm = new Date().getMinutes() < 10 ? '0' + new Date().getMinutes() : new Date().getMinutes() if(play.urls){
return yy + '' + dd + '' + HH + '' + MM + '' + mm if(subtitle){
} play['subtitle'] = subtitle;
let sharetoken = JSON.parse(request('https://api.aliyundrive.com/v2/share_link/get_share_token',{body:{"share_pwd":"","share_id":share_id},method:'POST',timeout:3000})).share_token;
let headers = {
'content-type':'application/json;charset=UTF-8',
"origin": "https://www.aliyundrive.com",
"referer": "https://www.aliyundrive.com/",
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36 Edg/110.0.1587.41",
"x-canary": "client=web,app=adrive,version=v3.1.0"
};
let userinfo;
let aliuserinfo = storage0.getMyVar('aliuserinfo');
if(aliuserinfo&&aliuserinfo.user_id){
userinfo = aliuserinfo;
}else{
userinfo = JSON.parse(request('https://auth.aliyundrive.com/v2/account/token',{headers:headers,body:{"refresh_token":alitoken,"grant_type":"refresh_token"},method:'POST',timeout:3000}));
storage0.putMyVar('aliuserinfo',userinfo);
}
let authorization = 'Bearer '+userinfo.access_token;
let userId = userinfo.user_id;
let deviceId = userinfo.device_id;
let getaliecc = JSON.parse(request('http://124.221.241.174:87/api',{body:'did='+deviceId+'&uid='+userId+'&token='+md5(getNowTime()),method:'POST',timeout:3000}));
let signature;
let public_key;
if(getaliecc.code==200){
signature = getaliecc.sign;
public_key = getaliecc.key;
}
headers['authorization'] = authorization;
headers['x-device-id'] = deviceId;
headers['x-signature'] = signature;
let data = {
"deviceName": "Edge浏览器",
"modelName": "Windows网页版",
"pubKey": public_key,
}
if(signature&&public_key){
let req = JSON.parse(request("https://api.aliyundrive.com/users/v1/users/device/create_session",{headers:headers,body:data,timeout:3000}));
if(req.success){
headers['x-share-token'] = sharetoken;
headers['fileid'] = userinfo.user_id;
data = {
"category":"live_transcoding",
"file_id":file_id,
"get_preview_url":true,
"share_id":share_id,
"template_id":"",
"get_subtitle_info":true
}
let json = JSON.parse(request('https://api.aliyundrive.com/v2/file/get_share_link_video_preview_play_info',{headers:headers,body:data,method:'POST',timeout:3000}));
let playurl = json.video_preview_play_info.live_transcoding_task_list;
playurl.reverse();
let urls = [];
let names = [];
let heads = [];
playurl.forEach(item => {
let rurl = JSON.parse(request(item.url,{headers:{'Referer':'https://www.aliyundrive.com/'},onlyHeaders:true,redirect:false,timeout:3000})).headers.location[0];
urls.push(rurl+"#isVideo=true##pre#");
names.push(transcoding[item.template_id]?transcoding[item.template_id]:item.template_height);
heads.push({'Referer':'https://www.aliyundrive.com/'});
})
return {
urls: urls,
names: names,
headers: heads
};
}
} }
}catch(e){ return JSON.stringify(play);
log('获取共享链接播放地址失败>'+e.message);
return {};
} }
} }catch(e){}
let redirect = JSON.parse(request(url,{onlyHeaders:true,redirect:false,timeout:3000}));
let rurl = redirect.headers.location[0];
let share_id = rurl.split('&sl=')[1].split('&')[0];
let file_id = rurl.split('&f=')[1].split('&')[0];
let alitoken = alistconfig.alitoken;
let play = getAliUrl(share_id,file_id,alitoken);
if(play.urls){
if(subtitle){
play['subtitle'] = subtitle;
}
return JSON.stringify(play);
}
} }
url = url + (music.test(suffix)?"#isMusic=true#":"#isVideo=true#") + (url.indexOf('baidu.com')>-1?';{User-Agent@Lavf/57.83.100}':url.indexOf('mypikpak.com')>-1?';{dns@https://dns.alidns.com/dns-query}':''); url = url + (music.test(suffix)?"#isMusic=true#":"#isVideo=true#") + (url.indexOf('baidu.com')>-1?';{User-Agent@Lavf/57.83.100}':url.indexOf('mypikpak.com')>-1?';{dns@https://dns.alidns.com/dns-query}':'');
if(!subtitle){ if(!subtitle){
@ -928,4 +848,86 @@ function alistSet() {
}) })
setResult(d); setResult(d);
} }
function getAliUrl(share_id,file_id,alitoken){
try{
function getNowTime() {
const yy = new Date().getFullYear()
const MM = (new Date().getMonth() + 1) < 10 ? '0' + (new Date().getMonth() + 1) : (new Date().getMonth() + 1)
const dd = new Date().getDate() < 10 ? '0' + new Date().getDate() : new Date().getDate()
const HH = new Date().getHours() < 10 ? '0' + new Date().getHours() : new Date().getHours()
const mm = new Date().getMinutes() < 10 ? '0' + new Date().getMinutes() : new Date().getMinutes()
return yy + '' + dd + '' + HH + '' + MM + '' + mm
}
let sharetoken = JSON.parse(request('https://api.aliyundrive.com/v2/share_link/get_share_token',{body:{"share_pwd":"","share_id":share_id},method:'POST',timeout:3000})).share_token;
let headers = {
'content-type':'application/json;charset=UTF-8',
"origin": "https://www.aliyundrive.com",
"referer": "https://www.aliyundrive.com/",
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36 Edg/110.0.1587.41",
"x-canary": "client=web,app=adrive,version=v3.1.0"
};
let userinfo;
let aliuserinfo = storage0.getMyVar('aliuserinfo');
if(aliuserinfo&&aliuserinfo.user_id){
userinfo = aliuserinfo;
}else{
userinfo = JSON.parse(request('https://auth.aliyundrive.com/v2/account/token',{headers:headers,body:{"refresh_token":alitoken,"grant_type":"refresh_token"},method:'POST',timeout:3000}));
storage0.putMyVar('aliuserinfo',userinfo);
}
let authorization = 'Bearer '+userinfo.access_token;
let userId = userinfo.user_id;
let deviceId = userinfo.device_id;
let getaliecc = JSON.parse(request('http://124.221.241.174:87/api',{body:'did='+deviceId+'&uid='+userId+'&token='+md5(getNowTime()),method:'POST',timeout:3000}));
let signature;
let public_key;
if(getaliecc.code==200){
signature = getaliecc.sign;
public_key = getaliecc.key;
}
headers['authorization'] = authorization;
headers['x-device-id'] = deviceId;
headers['x-signature'] = signature;
let data = {
"deviceName": "Edge浏览器",
"modelName": "Windows网页版",
"pubKey": public_key,
}
if(signature&&public_key){
let req = JSON.parse(request("https://api.aliyundrive.com/users/v1/users/device/create_session",{headers:headers,body:data,timeout:3000}));
if(req.success){
headers['x-share-token'] = sharetoken;
headers['fileid'] = userinfo.user_id;
data = {
"category":"live_transcoding",
"file_id":file_id,
"get_preview_url":true,
"share_id":share_id,
"template_id":"",
"get_subtitle_info":true
}
let json = JSON.parse(request('https://api.aliyundrive.com/v2/file/get_share_link_video_preview_play_info',{headers:headers,body:data,method:'POST',timeout:3000}));
let playurl = json.video_preview_play_info.live_transcoding_task_list;
playurl.reverse();
let urls = [];
let names = [];
let heads = [];
playurl.forEach(item => {
let rurl = JSON.parse(request(item.url,{headers:{'Referer':'https://www.aliyundrive.com/'},onlyHeaders:true,redirect:false,timeout:3000})).headers.location[0];
urls.push(rurl+"#isVideo=true##pre#");
names.push(transcoding[item.template_id]?transcoding[item.template_id]:item.template_height);
heads.push({'Referer':'https://www.aliyundrive.com/'});
})
return {
urls: urls,
names: names,
headers: heads
};
}
}
}catch(e){
log('获取共享链接播放地址失败>'+e.message);
return {};
}
}
Loading…
Cancel
Save