diff --git a/SrcJyAliDisk.js b/SrcJyAliDisk.js
index 10fa1ac..65b7955 100644
--- a/SrcJyAliDisk.js
+++ b/SrcJyAliDisk.js
@@ -26,9 +26,10 @@ function aliShare(share_id, folder_id, share_pwd) {
setPageTitle(typeof(MY_PARAMS)!="undefined" && MY_PARAMS.dirname ? MY_PARAMS.dirname : '云盘共享文件 | 聚影√');
share_pwd = share_pwd || "";
try{
- let sharetoken = JSON.parse(request('https://api.aliyundrive.com/v2/share_link/get_share_token', { headers: headers, body: { "share_pwd": share_pwd, "share_id": share_id }, method: 'POST', timeout: 3000 })).share_token;
+ let sharetoken = JSON.parse(request('https://api.aliyundrive.com/v2/share_link/get_share_token', { headers: headers, body: { "share_pwd": share_pwd, "share_id": share_id }, method: 'POST', timeout: 6000 })).share_token;
let postdata = { "share_id": share_id, "parent_file_id": folder_id || "root", "limit": 200, "image_thumbnail_process": "image/resize,w_256/format,jpeg", "image_url_process": "image/resize,w_1920/format,jpeg/interlace,1", "video_thumbnail_process": "video/snapshot,t_1000,f_jpg,ar_auto,w_256", "order_by": "name", "order_direction": "DESC" };
headers['x-share-token'] = sharetoken;
+ headers['x-canary:'] = "client=web,app=share,version=v2.3.1";
let sharelist = JSON.parse(request('https://api.aliyundrive.com/adrive/v2/file/list_by_share', { headers: headers, body: postdata, method: 'POST' })).items;
if(sharelist.length>0){
d.push({
@@ -36,84 +37,85 @@ function aliShare(share_id, folder_id, share_pwd) {
url: "smartdrive://share/browse?shareId="+share_id+"&sharePwd="+share_pwd,
col_type: 'text_center_1'
})
- }
- let sublist = sharelist.filter(item => {
- return item.type == "file" && /srt|vtt|ass/.test(item.file_extension);
- })
-
- let dirlist = sharelist.filter((item) => {
- return item.type == "folder";
- })
- dirlist.forEach((item) => {
- d.push({
- title: item.name,
- img: "hiker://files/cache/src/文件夹.svg",//#noRecordHistory##noHistory#
- url: $("hiker://empty##https://www.aliyundrive.com/s/"+item.share_id+(item.file_id?"/folder/"+item.file_id:"")).rule((share_id, folder_id, share_pwd) => {
- require(config.依赖.match(/http(s)?:\/\/.*\//)[0] + 'SrcJyAliDisk.js');
- aliShare(share_id, folder_id, share_pwd);
- }, item.share_id, item.file_id, share_pwd),
- col_type: 'avatar',
- extra: {
- dirname: item.name
- }
+ let sublist = sharelist.filter(item => {
+ return item.type == "file" && /srt|vtt|ass/.test(item.file_extension);
})
- })
- let filelist = sharelist.filter((item) => {
- return item.type == "file";
- })
- filelist.sort(SortList);
- filelist.forEach((item) => {
- if (item.category == "video") {
- let sub_file_id;
- if (sublist.length == 1) {
- sub_file_id = sublist[0].file_id;
- } else if (sublist.length > 1) {
- sublist.forEach(it => {
- if (it.name.substring(0, it.name.lastIndexOf(".")) == item.name.substring(0, item.name.lastIndexOf("."))) {
- sub_file_id = it.file_id;
- }
- })
- }
- let filesize = item.size/1024/1024;
+ let dirlist = sharelist.filter((item) => {
+ return item.type == "folder";
+ })
+ dirlist.forEach((item) => {
d.push({
title: item.name,
- img: item.thumbnail || (item.category == "video" ? "hiker://files/cache/src/影片.svg" : item.category == "audio" ? "hiker://files/cache/src/音乐.svg" : item.category == "image" ? "hiker://files/cache/src/图片.png" : "https://img.alicdn.com/imgextra/i1/O1CN01mhaPJ21R0UC8s9oik_!!6000000002049-2-tps-80-80.png"),
- url: $("hiker://empty##").lazyRule((share_id, file_id, sub_file_id, share_pwd) => {
- require(config.依赖.match(/http(s)?:\/\/.*\//)[0] + 'SrcJyAliPublic.js');
- let play = getAliUrl(share_id, file_id, alitoken, share_pwd);
- if (play.urls) {
- let subtitle;
- if (sub_file_id) {
- subtitle = getSubtitle(share_id, sub_file_id, share_pwd);
- }
- if (subtitle) {
- play['subtitle'] = subtitle;
- }
- return JSON.stringify(play);
- }else{
- return "toast://获取转码播放列表失败,阿里token无效";
- }
- }, item.share_id, item.file_id, sub_file_id||"", share_pwd),
- desc: filesize < 1024 ? filesize.toFixed(2) + 'MB' : (filesize/1024).toFixed(2) + 'GB',
+ img: "hiker://files/cache/src/文件夹.svg",//#noRecordHistory##noHistory#
+ url: $("hiker://empty##https://www.aliyundrive.com/s/"+item.share_id+(item.file_id?"/folder/"+item.file_id:"")).rule((share_id, folder_id, share_pwd) => {
+ require(config.依赖.match(/http(s)?:\/\/.*\//)[0] + 'SrcJyAliDisk.js');
+ aliShare(share_id, folder_id, share_pwd);
+ }, item.share_id, item.file_id, share_pwd),
col_type: 'avatar',
extra: {
- id: item.file_id
+ dirname: item.name
}
})
- }
- })
- d.push({
- title: "““””已开启文件过滤,仅显示视频文件",
- url: "hiker://empty",
- col_type: "text_center_1"
- })
+ })
+ let filelist = sharelist.filter((item) => {
+ return item.type == "file";
+ })
+ filelist.sort(SortList);
+ filelist.forEach((item) => {
+ if (item.category == "video") {
+ let sub_file_id;
+ if (sublist.length == 1) {
+ sub_file_id = sublist[0].file_id;
+ } else if (sublist.length > 1) {
+ sublist.forEach(it => {
+ if (it.name.substring(0, it.name.lastIndexOf(".")) == item.name.substring(0, item.name.lastIndexOf("."))) {
+ sub_file_id = it.file_id;
+ }
+ })
+ }
+ let filesize = item.size/1024/1024;
+ d.push({
+ title: item.name,
+ img: item.thumbnail || (item.category == "video" ? "hiker://files/cache/src/影片.svg" : item.category == "audio" ? "hiker://files/cache/src/音乐.svg" : item.category == "image" ? "hiker://files/cache/src/图片.png" : "https://img.alicdn.com/imgextra/i1/O1CN01mhaPJ21R0UC8s9oik_!!6000000002049-2-tps-80-80.png"),
+ url: $("hiker://empty##").lazyRule((share_id, file_id, sub_file_id, share_pwd) => {
+ require(config.依赖.match(/http(s)?:\/\/.*\//)[0] + 'SrcJyAliPublic.js');
+ let play = getAliUrl(share_id, file_id, alitoken, share_pwd);
+ if (play.urls) {
+ let subtitle;
+ if (sub_file_id) {
+ subtitle = getSubtitle(share_id, sub_file_id, share_pwd);
+ }
+ if (subtitle) {
+ play['subtitle'] = subtitle;
+ }
+ return JSON.stringify(play);
+ }else{
+ return "toast://获取转码播放列表失败,阿里token无效";
+ }
+ }, item.share_id, item.file_id, sub_file_id||"", share_pwd),
+ desc: filesize < 1024 ? filesize.toFixed(2) + 'MB' : (filesize/1024).toFixed(2) + 'GB',
+ col_type: 'avatar',
+ extra: {
+ id: item.file_id
+ }
+ })
+ }
+ })
+ d.push({
+ title: "““””已开启文件过滤,仅显示视频文件",
+ url: "hiker://empty",
+ col_type: "text_center_1"
+ })
+ }else{
+ toast('列表为空');
+ }
}catch(e){
d.push({
title: '来晚啦,该分享已失效',
url: 'hiker://empty##',
col_type: "text_center_1"
})
- toast('来晚啦,该分享已失效.');
+ toast('该分享已失效或超时,可刷新确认下');
}
setResult(d);
setLastChapterRule('js:' + $.toString(()=>{
@@ -248,95 +250,100 @@ function aliMyDisk(folder_id,nofilter) {
}
try{
let drive_id = userinfo.default_drive_id;
- let postdata = {"drive_id":drive_id,"parent_file_id":folder_id,"limit":200,"all":false,"url_expire_sec":14400,"image_thumbnail_process":"image/resize,w_256/format,jpeg","image_url_process":"image/resize,w_1920/format,jpeg/interlace,1","video_thumbnail_process":"video/snapshot,t_1000,f_jpg,ar_auto,w_256","fields":"*","order_by":"updated_at","order_direction":"DESC"};
+ let postdata = {"drive_id":drive_id,"parent_file_id":folder_id,"limit":200,"all":false,"url_expire_sec":14400,"image_thumbnail_process":"image/resize,w_256/format,jpeg","image_url_process":"image/resize,w_1920/format,jpeg/interlace,1","video_thumbnail_process":"video/snapshot,t_1000,f_jpg,ar_auto,w_256","order_by":"updated_at","order_direction":"DESC"};
headers['authorization'] = 'Bearer ' + userinfo.access_token;
+ headers['x-canary'] = "client=web,app=adrive,version=v4.1.1";
let myfilelist = JSON.parse(request('https://api.aliyundrive.com/adrive/v3/file/list', { headers: headers, body: postdata, method: 'POST' })).items;
- let sublist = myfilelist.filter(item => {
- return item.type == "file" && /srt|vtt|ass/.test(item.file_extension);
- })
-
- let dirlist = myfilelist.filter((item) => {
- return item.type == "folder";
- })
- dirlist.forEach((item) => {
- d.push({
- title: item.name,
- img: "hiker://files/cache/src/文件夹.svg",
- url: $("hiker://empty").rule((folder_id,nofilter) => {
- require(config.依赖.match(/http(s)?:\/\/.*\//)[0] + 'SrcJyAliDisk.js');
- aliMyDisk(folder_id,nofilter);
- }, item.file_id,nofilter),
- col_type: 'avatar',
- extra: {
- dirname: item.name
- }
+ if(myfilelist.length>0){
+ let sublist = myfilelist.filter(item => {
+ return item.type == "file" && /srt|vtt|ass/.test(item.file_extension);
})
- })
- let filelist = myfilelist.filter((item) => {
- return item.type == "file";
- })
- filelist.sort(SortList);
- filelist.forEach((item) => {
- if (item.category == "video" || nofilter) {
- let sub_file_url;
- if (sublist.length == 1) {
- sub_file_url = sublist[0].url;
- } else if (sublist.length > 1) {
- sublist.forEach(it => {
- if (it.name.substring(0, it.name.lastIndexOf(".")) == item.name.substring(0, item.name.lastIndexOf("."))) {
- sub_file_url = it.url;
- }
- })
- }
- let filesize = item.size/1024/1024;
+ let dirlist = myfilelist.filter((item) => {
+ return item.type == "folder";
+ })
+ dirlist.forEach((item) => {
d.push({
title: item.name,
- img: item.thumbnail? item.thumbnail+"@Referer=https://www.aliyundrive.com/" : item.category == "video" ? "hiker://files/cache/src/影片.svg" : item.category == "audio" ? "hiker://files/cache/src/音乐.svg" : item.category == "image" ? "hiker://files/cache/src/图片.png" : "https://img.alicdn.com/imgextra/i1/O1CN01mhaPJ21R0UC8s9oik_!!6000000002049-2-tps-80-80.png@Referer=",
- url: $("hiker://empty##").lazyRule((category,file_id,file_url,sub_file_url) => {
- if(category=="video"){
- require(config.依赖.match(/http(s)?:\/\/.*\//)[0] + 'SrcJyAliPublic.js');
- if(alitoken){
- let play = aliMyPlayUrl(file_id);
- if (play.urls) {
- if (sub_file_url) {
- play['subtitle'] = sub_file_url;
+ img: "hiker://files/cache/src/文件夹.svg",
+ url: $("hiker://empty").rule((folder_id,nofilter) => {
+ require(config.依赖.match(/http(s)?:\/\/.*\//)[0] + 'SrcJyAliDisk.js');
+ aliMyDisk(folder_id,nofilter);
+ }, item.file_id,nofilter),
+ col_type: 'avatar',
+ extra: {
+ dirname: item.name
+ }
+ })
+ })
+ let filelist = myfilelist.filter((item) => {
+ return item.type == "file";
+ })
+ filelist.sort(SortList);
+ filelist.forEach((item) => {
+ if (item.category == "video" || nofilter) {
+ let sub_file_url;
+ if (sublist.length == 1) {
+ sub_file_url = sublist[0].url;
+ } else if (sublist.length > 1) {
+ sublist.forEach(it => {
+ if (it.name.substring(0, it.name.lastIndexOf(".")) == item.name.substring(0, item.name.lastIndexOf("."))) {
+ sub_file_url = it.url;
+ }
+ })
+ }
+ let filesize = item.size/1024/1024;
+ d.push({
+ title: item.name,
+ img: item.thumbnail? item.thumbnail+"@Referer=https://www.aliyundrive.com/" : item.category == "video" ? "hiker://files/cache/src/影片.svg" : item.category == "audio" ? "hiker://files/cache/src/音乐.svg" : item.category == "image" ? "hiker://files/cache/src/图片.png" : "https://img.alicdn.com/imgextra/i1/O1CN01mhaPJ21R0UC8s9oik_!!6000000002049-2-tps-80-80.png@Referer=",
+ url: $("hiker://empty##").lazyRule((category,file_id,file_url,sub_file_url) => {
+ if(category=="video"){
+ require(config.依赖.match(/http(s)?:\/\/.*\//)[0] + 'SrcJyAliPublic.js');
+ if(alitoken){
+ let play = aliMyPlayUrl(file_id);
+ if (play.urls) {
+ if (sub_file_url) {
+ play['subtitle'] = sub_file_url;
+ }
+ play.urls.unshift(file_url+ "#isVideo=true##pre#");
+ play.names.unshift("原始 画质");
+ play.headers.unshift({'Referer':'https://www.aliyundrive.com/'});
+ return JSON.stringify(play);
+ }else{
+ return "toast://"+play.message;
}
- play.urls.unshift(file_url+ "#isVideo=true##pre#");
- play.names.unshift("原始 画质");
- play.headers.unshift({'Referer':'https://www.aliyundrive.com/'});
- return JSON.stringify(play);
}else{
- return "toast://"+play.message;
+ return "toast://未获取到阿里token";
}
+ }else if(category == "audio"){
+ return file_url + ";{Referer@https://www.aliyundrive.com/}#isMusic=true#";
+ }else if(category == "image"){
+ return file_url + "#.jpg@Referer=https://www.aliyundrive.com/";
}else{
- return "toast://未获取到阿里token";
+ return "download://" + file_url + ";{Referer@https://www.aliyundrive.com/}";
}
- }else if(category == "audio"){
- return file_url + ";{Referer@https://www.aliyundrive.com/}#isMusic=true#";
- }else if(category == "image"){
- return file_url + "#.jpg@Referer=https://www.aliyundrive.com/";
- }else{
- return "download://" + file_url + ";{Referer@https://www.aliyundrive.com/}";
+ }, item.category, item.file_id, item.url||"", sub_file_url||""),
+ desc: filesize < 1024 ? filesize.toFixed(2) + 'MB' : (filesize/1024).toFixed(2) + 'GB',
+ col_type: 'avatar',
+ extra: {
+ id: item.file_id,
+ inheritTitle: false
}
- }, item.category, item.file_id, item.url||"", sub_file_url||""),
- desc: filesize < 1024 ? filesize.toFixed(2) + 'MB' : (filesize/1024).toFixed(2) + 'GB',
- col_type: 'avatar',
- extra: {
- id: item.file_id
- }
+ })
+ }
+ })
+ if(!nofilter){
+ d.push({
+ title: "““””已开启文件过滤,仅显示视频文件",
+ url: "hiker://empty",
+ col_type: "text_center_1"
})
}
- })
- if(!nofilter){
- d.push({
- title: "““””已开启文件过滤,仅显示视频文件",
- url: "hiker://empty",
- col_type: "text_center_1"
- })
+ }else{
+ toast('列表为空');
}
}catch(e){
log(e.message);
- toast('有异常,可查看日志');
+ toast('有异常查看日志,可刷新确认下');
}
}else{
d.push({