From 080e1644a7fbedb6aaf5e4466594b3f60cd97315 Mon Sep 17 00:00:00 2001 From: qist <87984115@qq.com> Date: Thu, 16 Nov 2023 15:10:40 +0800 Subject: [PATCH] =?UTF-8?q?ghproxy.com=20=E8=A2=AB=E5=A2=99=20=E6=94=B9?= =?UTF-8?q?=E6=88=90mirror.ghproxy.com?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 0821.json | 16 ++++++++-------- 9918.json | 4 ++-- README.md | 10 +++++----- js/lf_live.txt | 18 +++++++++--------- js/lf_live1.txt | 4 ++-- js/live2mv_data.json | 22 +++++++++++----------- lib/alist.min.js | 2 +- 7 files changed, 38 insertions(+), 38 deletions(-) diff --git a/0821.json b/0821.json index 5a77b310..6ccefb62 100644 --- a/0821.json +++ b/0821.json @@ -1,20 +1,20 @@ { "spider":"./jar/fan.txt;md5;364c0f012e73a8801a69900fc25ae9c1", "lives":[{"name":"初秋语•综合","type":0,"url":"./list.txt","playerType":1,"epg":"http://epg.112114.xyz/?ch={name}&date={date}","logo":"https://epg.112114.xyz/logo/{name}.png"}, -{"name":"YanG•综合","type":0,"url":"https://ghproxy.com/https://raw.githubusercontent.com/YanG-1989/m3u/main/Gather.m3u","playerType":1,"epg":"http://epg.112114.xyz/?ch={name}&date={date}","logo":"https://epg.112114.xyz/logo/{name}.png"}, -{"name":"范明明•综合","type":0,"url":"https://ghproxy.com/https://raw.githubusercontent.com/fanmingming/live/main/tv/m3u/global.m3u","playerType":1,"epg":"http://epg.112114.xyz/?ch={name}&date={date}","logo":"https://epg.112114.xyz/logo/{name}.png"}, -{"name":"YueChan•综合","type":0,"url":"https://ghproxy.com/https://raw.githubusercontent.com/YueChan/Live/main/IPTV.m3u","playerType":1,"epg":"http://epg.112114.xyz/?ch={name}&date={date}","logo":"https://epg.112114.xyz/logo/{name}.png"}, +{"name":"YanG•综合","type":0,"url":"https://mirror.ghproxy.com/https://raw.githubusercontent.com/YanG-1989/m3u/main/Gather.m3u","playerType":1,"epg":"http://epg.112114.xyz/?ch={name}&date={date}","logo":"https://epg.112114.xyz/logo/{name}.png"}, +{"name":"范明明•综合","type":0,"url":"https://mirror.ghproxy.com/https://raw.githubusercontent.com/fanmingming/live/main/tv/m3u/global.m3u","playerType":1,"epg":"http://epg.112114.xyz/?ch={name}&date={date}","logo":"https://epg.112114.xyz/logo/{name}.png"}, +{"name":"YueChan•综合","type":0,"url":"https://mirror.ghproxy.com/https://raw.githubusercontent.com/YueChan/Live/main/IPTV.m3u","playerType":1,"epg":"http://epg.112114.xyz/?ch={name}&date={date}","logo":"https://epg.112114.xyz/logo/{name}.png"}, {"name":"Yoursmile•综合","type":0,"url":"https://agit.ai/Yoursmile7/TVBox/raw/branch/master/live.txt","playerType":1,"epg":"http://epg.112114.xyz/?ch={name}&date={date}","logo":"https://epg.112114.xyz/logo/{name}.png"}, {"name":"饭太硬•综合","type":0,"url":"https://agit.ai/fantaiying/0/raw/branch/main/tvlive.txt","playerType":1,"ua": "okhttp/3.15","epg":"http://epg.112114.xyz/?ch={name}&date={date}","logo": "https://epg.112114.xyz/logo/{name}.png"}, {"name":"Ray•综合","type":0,"url":"https://xhdwc.tk/tvlive.txt","playerType":1,"epg":"http://epg.112114.xyz/?ch={name}&date={date}","logo":"https://epg.112114.xyz/logo/{name}.png"}, {"name":"俊于•综合","type":0,"url":"http://home.jundie.top:81/Cat/tv/live.txt","playerType":1,"epg":"http://epg.112114.xyz/?ch={name}&date={date}","logo": "https://epg.112114.xyz/logo/{name}.png"}, {"name":"初秋语•电台","type":0,"url":"./radio.txt","playerType":1}, -{"name":"范明明•电台","type":0,"url":"https://ghproxy.com/https://raw.githubusercontent.com/fanmingming/live/main/radio/m3u/index.m3u","playerType":1}, -{"name":"肥羊•斗鱼","type":0,"url":"https://ghproxy.com/https://raw.githubusercontent.com/Ftindy/IPTV-URL/main/douyuyqk.m3u","playerType":1}, -{"name":"肥羊•虎牙","type":0,"url":"https://ghproxy.com/https://raw.githubusercontent.com/Ftindy/IPTV-URL/main/huyayqk.m3u","playerType":1}, -{"name":"肥羊•YY","type":0,"url":"https://ghproxy.com/https://raw.githubusercontent.com/Ftindy/IPTV-URL/main/yylunbo.m3u","playerType":1}, +{"name":"范明明•电台","type":0,"url":"https://mirror.ghproxy.com/https://raw.githubusercontent.com/fanmingming/live/main/radio/m3u/index.m3u","playerType":1}, +{"name":"肥羊•斗鱼","type":0,"url":"https://mirror.ghproxy.com/https://raw.githubusercontent.com/Ftindy/IPTV-URL/main/douyuyqk.m3u","playerType":1}, +{"name":"肥羊•虎牙","type":0,"url":"https://mirror.ghproxy.com/https://raw.githubusercontent.com/Ftindy/IPTV-URL/main/huyayqk.m3u","playerType":1}, +{"name":"肥羊•YY","type":0,"url":"https://mirror.ghproxy.com/https://raw.githubusercontent.com/Ftindy/IPTV-URL/main/yylunbo.m3u","playerType":1}, {"name":"初秋语•哔哩","type":0,"url":"./bili.m3u","playerType":1}, -{"name":"YuanHsing•油管","type":0,"url":"https://ghproxy.com/https://raw.githubusercontent.com/YuanHsing/YouTube_to_m3u/main/youtube.m3u"} +{"name":"YuanHsing•油管","type":0,"url":"https://mirror.ghproxy.com/https://raw.githubusercontent.com/YuanHsing/YouTube_to_m3u/main/youtube.m3u"} ], "wallpaper":"http://饭太硬.top/深色壁纸/api.php", "sites":[ diff --git a/9918.json b/9918.json index 38bee5cc..e388d359 100644 --- a/9918.json +++ b/9918.json @@ -1,8 +1,8 @@ { "spider":"./jar/fm.nogo.20231114-2003.jar;md5;029f704677c51eb527a55796173cf82b", "lives":[{"name":"初秋语","type":0,"url":"./listx.txt"}, -{"name":"YanG","type":0,"url":"https://ghproxy.com/https://raw.githubusercontent.com/YanG-1989/m3u/main/Adult.m3u"}, -{"name":"atsushi","type":0,"url":"https://ghproxy.com/https://raw.githubusercontent.com/atsushi444/iptv-epg/main/Adult.m3u"}, +{"name":"YanG","type":0,"url":"https://mirror.ghproxy.com/https://raw.githubusercontent.com/YanG-1989/m3u/main/Adult.m3u"}, +{"name":"atsushi","type":0,"url":"https://mirror.ghproxy.com/https://raw.githubusercontent.com/atsushi444/iptv-epg/main/Adult.m3u"}, {"name":"小武哥","type":0,"url":"https://qu.ax/PEHy.txt"}, {"name":"AV","type":0,"url":"./livex.m3u"} ], diff --git a/README.md b/README.md index c340dc05..226ef6f8 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ FongMi影视、TVBox、猫影视配置文件。所有资源均来自于各路大 (1)唐三:https://gh.t4tv.hz.cz/newtang.bmp -(2)Fongmi:https://mirror.ghproxy.com/https://raw.githubusercontent.com/gaotianliuyun/fongmi/main/json/config.json +(2)Fongmi:https://mirror.mirror.ghproxy.com/https://raw.githubusercontent.com/gaotianliuyun/fongmi/main/json/config.json (3)俊于:http://home.jundie.top:81/top98.json @@ -67,7 +67,7 @@ FongMi影视、TVBox、猫影视配置文件。所有资源均来自于各路大 (5)肥猫:http://我不是.肥猫.love:63/接口禁止贩卖 -(6)霜辉月明py:https://mirror.ghproxy.com/raw.githubusercontent.com/lm317379829/PyramidStore/pyramid/py.json +(6)霜辉月明py:https://mirror.mirror.ghproxy.com/raw.githubusercontent.com/lm317379829/PyramidStore/pyramid/py.json (7)小米小爆脾气:http://xhww.fun:63/小米/DEMO.json @@ -91,7 +91,7 @@ FongMi影视、TVBox、猫影视配置文件。所有资源均来自于各路大 (17)潇洒:https://download.kstore.space/download/2863/01.txt -(18)佰欣园:https://mirror.ghproxy.com/https://raw.githubusercontent.com/chengxueli818913/maoTV/main/44.txt +(18)佰欣园:https://mirror.mirror.ghproxy.com/https://raw.githubusercontent.com/chengxueli818913/maoTV/main/44.txt (19)胖虎:https://notabug.org/imbig66/tv-spider-man/raw/master/配置/0801.json @@ -99,7 +99,7 @@ FongMi影视、TVBox、猫影视配置文件。所有资源均来自于各路大 (21)Yoursmile7:https://agit.ai/Yoursmile7/TVBox/raw/branch/master/XC.json -(22)Ray:https://mirror.ghproxy.com/https://raw.githubusercontent.com/dxawi/0/main/0.json +(22)Ray:https://mirror.mirror.ghproxy.com/https://raw.githubusercontent.com/dxawi/0/main/0.json (23)甜蜜:https://kebedd69.github.io/TVbox-interface/py甜蜜.json @@ -109,7 +109,7 @@ FongMi影视、TVBox、猫影视配置文件。所有资源均来自于各路大 (26)电视(自用): https://github.moeyy.xyz/raw.githubusercontent.com/qist/tvbox/master/jsm.json -(27)github代理地址: `https://github.moeyy.xyz https://mirror.ghproxy.com/ https://gh-proxy.com https://ghproxy.net` 选择一个速度快使用 +(27)github代理地址: `https://github.moeyy.xyz https://mirror.mirror.ghproxy.com/ https://gh-proxy.com https://ghproxy.net` 选择一个速度快使用 4. 随机轮换壁纸: diff --git a/js/lf_live.txt b/js/lf_live.txt index 4ec23f5b..de035970 100644 --- a/js/lf_live.txt +++ b/js/lf_live.txt @@ -9,11 +9,11 @@ #初秋语•综合 ../list.txt #YanG•综合 -https://ghproxy.com/https://raw.githubusercontent.com/YanG-1989/m3u/main/Gather.m3u +https://mirror.ghproxy.com/https://raw.githubusercontent.com/YanG-1989/m3u/main/Gather.m3u #范明明•综合 -https://ghproxy.com/https://raw.githubusercontent.com/fanmingming/live/main/tv/m3u/global.m3u +https://mirror.ghproxy.com/https://raw.githubusercontent.com/fanmingming/live/main/tv/m3u/global.m3u #YueChan•综合 -https://ghproxy.com/https://raw.githubusercontent.com/YueChan/Live/main/IPTV.m3u +https://mirror.ghproxy.com/https://raw.githubusercontent.com/YueChan/Live/main/IPTV.m3u #Yoursmile•综合 https://agit.ai/Yoursmile7/TVBox/raw/branch/master/live.txt #饭太硬•综合 @@ -25,16 +25,16 @@ http://home.jundie.top:81/Cat/tv/live.txt #初秋语•电台 ../radio.txt #范明明•电台 -https://ghproxy.com/https://raw.githubusercontent.com/fanmingming/live/main/radio/m3u/index.m3u +https://mirror.ghproxy.com/https://raw.githubusercontent.com/fanmingming/live/main/radio/m3u/index.m3u #肥羊•斗鱼 -https://ghproxy.com/https://raw.githubusercontent.com/Ftindy/IPTV-URL/main/douyuyqk.m3u +https://mirror.ghproxy.com/https://raw.githubusercontent.com/Ftindy/IPTV-URL/main/douyuyqk.m3u #肥羊•虎牙 -https://ghproxy.com/https://raw.githubusercontent.com/Ftindy/IPTV-URL/main/huyayqk.m3u +https://mirror.ghproxy.com/https://raw.githubusercontent.com/Ftindy/IPTV-URL/main/huyayqk.m3u #肥羊•YY -https://ghproxy.com/https://raw.githubusercontent.com/Ftindy/IPTV-URL/main/yylunbo.m3u +https://mirror.ghproxy.com/https://raw.githubusercontent.com/Ftindy/IPTV-URL/main/yylunbo.m3u #初秋语•哔哩 ../bili.m3u #16万MV -https://ghproxy.com/https://raw.githubusercontent.com/lystv/short/main/影视/tvb/MTV.txt +https://mirror.ghproxy.com/https://raw.githubusercontent.com/lystv/short/main/影视/tvb/MTV.txt #YuanHsing•油管 -https://ghproxy.com/https://raw.githubusercontent.com/YuanHsing/YouTube_to_m3u/main/youtube.m3u \ No newline at end of file +https://mirror.ghproxy.com/https://raw.githubusercontent.com/YuanHsing/YouTube_to_m3u/main/youtube.m3u \ No newline at end of file diff --git a/js/lf_live1.txt b/js/lf_live1.txt index d86c29f8..47f98c72 100644 --- a/js/lf_live1.txt +++ b/js/lf_live1.txt @@ -9,8 +9,8 @@ #初秋语 ../listx.txt #YanG -https://ghproxy.com/https://raw.githubusercontent.com/YanG-1989/m3u/main/Adult.m3u +https://mirror.ghproxy.com/https://raw.githubusercontent.com/YanG-1989/m3u/main/Adult.m3u #atsushi -https://ghproxy.com/https://raw.githubusercontent.com/atsushi444/iptv-epg/main/Adult.m3u +https://mirror.ghproxy.com/https://raw.githubusercontent.com/atsushi444/iptv-epg/main/Adult.m3u #AV集 ../livex.m3u diff --git a/js/live2mv_data.json b/js/live2mv_data.json index 7fa390a5..509a11aa 100644 --- a/js/live2mv_data.json +++ b/js/live2mv_data.json @@ -1,17 +1,17 @@ [ -{"name":"初秋语•综合","url":"https://ghproxy.com/https:/raw.githubusercontent.com/gaotianliuyun/gao/master/list.txt"}, -{"name":"YanG•综合","url":"https://ghproxy.com/https://raw.githubusercontent.com/YanG-1989/m3u/main/Gather.m3u"}, -{"name":"范明明•综合","url":"https://ghproxy.com/https://raw.githubusercontent.com/fanmingming/live/main/tv/m3u/global.m3u"}, -{"name":"YueChan•综合","url":"https://ghproxy.com/https://raw.githubusercontent.com/YueChan/Live/main/IPTV.m3u"}, +{"name":"初秋语•综合","url":"https://mirror.ghproxy.com/https:/raw.githubusercontent.com/gaotianliuyun/gao/master/list.txt"}, +{"name":"YanG•综合","url":"https://mirror.ghproxy.com/https://raw.githubusercontent.com/YanG-1989/m3u/main/Gather.m3u"}, +{"name":"范明明•综合","url":"https://mirror.ghproxy.com/https://raw.githubusercontent.com/fanmingming/live/main/tv/m3u/global.m3u"}, +{"name":"YueChan•综合","url":"https://mirror.ghproxy.com/https://raw.githubusercontent.com/YueChan/Live/main/IPTV.m3u"}, {"name":"Yoursmile•综合","url":"https://agit.ai/Yoursmile7/TVBox/raw/branch/master/live.txt"}, {"name":"饭太硬•综合","url":"https://agit.ai/fantaiying/0/raw/branch/main/tvlive.txt"}, {"name":"Ray•综合","url":"https://xhdwc.tk/tvlive.txt"}, {"name":"俊于•综合","url":"http://home.jundie.top:81/Cat/tv/live.txt"}, -{"name":"初秋语•电台","url":"https://ghproxy.com/https:/raw.githubusercontent.com/gaotianliuyun/gao/master/radio.txt"}, -{"name":"范明明•电台","url":"https://ghproxy.com/https://raw.githubusercontent.com/fanmingming/live/main/radio/m3u/index.m3u"}, -{"name":"肥羊•斗鱼","url":"https://ghproxy.com/https://raw.githubusercontent.com/Ftindy/IPTV-URL/main/douyuyqk.m3u"}, -{"name":"肥羊•虎牙","url":"https://ghproxy.com/https://raw.githubusercontent.com/Ftindy/IPTV-URL/main/huyayqk.m3u"}, -{"name":"肥羊•YY","url":"https://ghproxy.com/https://raw.githubusercontent.com/Ftindy/IPTV-URL/main/yylunbo.m3u"}, -{"name":"初秋语•哔哩","url":"https://ghproxy.com/https:/raw.githubusercontent.com/gaotianliuyun/gao/master/bili.m3u"}, -{"name":"YuanHsing•油管","url":"https://ghproxy.com/https://raw.githubusercontent.com/YuanHsing/YouTube_to_m3u/main/youtube.m3u"} +{"name":"初秋语•电台","url":"https://mirror.ghproxy.com/https:/raw.githubusercontent.com/gaotianliuyun/gao/master/radio.txt"}, +{"name":"范明明•电台","url":"https://mirror.ghproxy.com/https://raw.githubusercontent.com/fanmingming/live/main/radio/m3u/index.m3u"}, +{"name":"肥羊•斗鱼","url":"https://mirror.ghproxy.com/https://raw.githubusercontent.com/Ftindy/IPTV-URL/main/douyuyqk.m3u"}, +{"name":"肥羊•虎牙","url":"https://mirror.ghproxy.com/https://raw.githubusercontent.com/Ftindy/IPTV-URL/main/huyayqk.m3u"}, +{"name":"肥羊•YY","url":"https://mirror.ghproxy.com/https://raw.githubusercontent.com/Ftindy/IPTV-URL/main/yylunbo.m3u"}, +{"name":"初秋语•哔哩","url":"https://mirror.ghproxy.com/https:/raw.githubusercontent.com/gaotianliuyun/gao/master/bili.m3u"}, +{"name":"YuanHsing•油管","url":"https://mirror.ghproxy.com/https://raw.githubusercontent.com/YuanHsing/YouTube_to_m3u/main/youtube.m3u"} ] \ No newline at end of file diff --git a/lib/alist.min.js b/lib/alist.min.js index ddd4adf5..b2723c23 100644 --- a/lib/alist.min.js +++ b/lib/alist.min.js @@ -1 +1 @@ -import{distance}from"./mod.js";import{sortListByCN}from"./sortName.js";String.prototype.rstrip=function(chars){let regex=new RegExp(chars+"$");return this.replace(regex,"")};var showMode="single";var searchDriver="";var limit_search_show=200;var search_type="";var detail_order="name";var playRaw=1;const request_timeout=5e3;const VERSION="alist v2/v3 20221223";const UA="Mozilla/5.0";function print(any){any=any||"";if(typeof any=="object"&&Object.keys(any).length>0){try{any=JSON.stringify(any);console.log(any)}catch(e){console.log(typeof any+":"+any.length)}}else if(typeof any=="object"&&Object.keys(any).length<1){console.log("null object")}else{console.log(any)}}function getHome(url){if(!url){return""}let tmp=url.split("//");url=tmp[0]+"//"+tmp[1].split("/")[0];try{url=decodeURIComponent(url)}catch(e){}return url}const http=function(url,options={}){if(options.method==="POST"&&options.data){options.body=JSON.stringify(options.data);options.headers=Object.assign({"content-type":"application/json"},options.headers)}options.timeout=request_timeout;if(!options.headers){options.headers={}}let keys=Object.keys(options.headers).map(it=>it.toLowerCase());if(!keys.includes("referer")){options.headers["Referer"]=getHome(url)}if(!keys.includes("user-agent")){options.headers["User-Agent"]=UA}try{const res=req(url,options);res.json=()=>res&&res.content?JSON.parse(res.content):null;res.text=()=>res&&res.content?res.content:"";return res}catch(e){return{json(){return null},text(){return""}}}};["get","post"].forEach(method=>{http[method]=function(url,options={}){return http(url,Object.assign(options,{method:method.toUpperCase()}))}});const __drives={};function isMedia(file){return/\.(dff|dsf|mp3|aac|wav|wma|cda|flac|m4a|mid|mka|mp2|mpa|mpc|ape|ofr|ogg|ra|wv|tta|ac3|dts|tak|webm|wmv|mpeg|mov|ram|swf|mp4|avi|rm|rmvb|flv|mpg|mkv|m3u8|ts|3gp|asf)$/.test(file.toLowerCase())}function get_drives_path(tid){const index=tid.indexOf("$");const name=tid.substring(0,index);const path=tid.substring(index+1);return{drives:get_drives(name),path:path}}function get_drives(name){const{settings,api,server}=__drives[name];if(settings.v3==null){settings.v3=false;const data=http.get(server+"/api/public/settings").json().data;if(Array.isArray(data)){settings.title=data.find(x=>x.key==="title")?.value;settings.v3=false;settings.version=data.find(x=>x.key==="version")?.value;settings.enableSearch=data.find(x=>x.key==="enable search")?.value==="true"}else{settings.title=data.title;settings.v3=true;settings.version=data.version;settings.enableSearch=false}api.path=settings.v3?"/api/fs/list":"/api/public/path";api.file=settings.v3?"/api/fs/get":"/api/public/path";api.search=settings.v3?"/api/public/search":"/api/public/search"}return __drives[name]}function init(ext){console.log("当前版本号:"+VERSION);let data;if(typeof ext=="object"){data=ext;print("alist ext:object")}else if(typeof ext=="string"){if(ext.startsWith("http")){let alist_data=ext.split(";");let alist_data_url=alist_data[0];limit_search_show=alist_data.length>1?Number(alist_data[1])||limit_search_show:limit_search_show;search_type=alist_data.length>2?alist_data[2]:search_type;print(alist_data_url);data=http.get(alist_data_url).json()}else{print("alist ext:json string");data=JSON.parse(ext)}}let drives=[];if(Array.isArray(data)&&data.length>0&&data[0].hasOwnProperty("server")&&data[0].hasOwnProperty("name")){drives=data}else if(!Array.isArray(data)&&data.hasOwnProperty("drives")&&Array.isArray(data.drives)){drives=data.drives.filter(it=>it.type&&it.type==="alist"||!it.type)}print(drives);searchDriver=(drives.find(x=>x.search)||{}).name||"";if(!searchDriver&&drives.length>0){searchDriver=drives[0].name}print(searchDriver);drives.forEach(item=>{let _path_param=[];if(item.params){_path_param=Object.keys(item.params);_path_param.sort((a,b)=>a.length-b.length)}if(item.password){let pwdObj={password:item.password};if(!item.params){item.params={"/":pwdObj}}else{item.params["/"]=pwdObj}_path_param.unshift("/")}__drives[item.name]={name:item.name,server:item.server.endsWith("/")?item.server.rstrip("/"):item.server,startPage:item.startPage||"/",showAll:item.showAll===true,search:!!item.search,params:item.params||{},_path_param:_path_param,settings:{},api:{},getParams(path){const key=this._path_param.find(x=>path.startsWith(x));return Object.assign({},this.params[key],{path:path})},getPath(path){const res=http.post(this.server+this.api.path,{data:this.getParams(path)}).json();return this.settings.v3?res.data.content:res.data.files},getFile(path){let raw_url=this.server+"/d"+path;raw_url=encodeURI(raw_url);let data={raw_url:raw_url,raw_url1:raw_url};if(playRaw===1){try{const res=http.post(this.server+this.api.file,{data:this.getParams(path)}).json();data=this.settings.v3?res.data:res.data.files[0];if(!this.settings.v3){data.raw_url=data.url}data.raw_url1=raw_url;return data}catch(e){return data}}else{return data}},isFolder(data){return data.type===1},isVideo(data){return this.settings.v3?data.type===2||data.type===0||data.type===3:data.type===3||data.type===0||data.type===4},is_subt(data){if(data.type===1){return false}const ext=/\.(srt|ass|scc|stl|ttml)$/;return ext.test(data.name)},getPic(data){let pic=this.settings.v3?data.thumb:data.thumbnail;return pic||(this.isFolder(data)?"http://img1.3png.com/281e284a670865a71d91515866552b5f172b.png":"")},getTime(data,isStandard){isStandard=isStandard||false;try{let tTime=data.updated_at||data.time_str||data.modified||"";let date="";if(tTime){tTime=tTime.split("T");date=tTime[0];if(isStandard){date=date.replace(/-/g,"/")}tTime=tTime[1].split(/Z|\./);date+=" "+tTime[0]}return date}catch(e){return""}}}});print("init执行完毕")}function home(filter){let classes=Object.keys(__drives).map(key=>({type_id:`${key}$${__drives[key].startPage}`,type_name:key,type_flag:"1"}));let filter_dict={};let filters=[{key:"order",name:"排序",value:[{n:"名称⬆️",v:"vod_name_asc"},{n:"名称⬇️",v:"vod_name_desc"},{n:"中英⬆️",v:"vod_cn_asc"},{n:"中英⬇️",v:"vod_cn_desc"},{n:"时间⬆️",v:"vod_time_asc"},{n:"时间⬇️",v:"vod_time_desc"},{n:"大小⬆️",v:"vod_size_asc"},{n:"大小⬇️",v:"vod_size_desc"},{n:"无",v:"none"}]},{key:"show",name:"播放展示",value:[{n:"单集",v:"single"},{n:"全集",v:"all"}]}];classes.forEach(it=>{filter_dict[it.type_id]=filters});print("----home----");print(classes);return JSON.stringify({class:classes,filters:filter_dict})}function homeVod(params){let _post_data={pageNum:0,pageSize:100};let _post_url="https://pbaccess.video.qq.com/trpc.videosearch.hot_rank.HotRankServantHttp/HotRankHttp";let data=http.post(_post_url,{data:_post_data}).json();let _list=[];try{data=data["data"]["navItemList"][0]["hotRankResult"]["rankItemList"];data.forEach(it=>{_list.push({vod_name:it.title,vod_id:"msearch:"+it.title,vod_pic:"https://avatars.githubusercontent.com/u/97389433?s=120&v=4",vod_remarks:it.changeOrder})})}catch(e){print("Alist获取首页推荐发送错误:"+e.message)}return JSON.stringify({list:_list})}function category(tid,pg,filter,extend){let orid=tid.replace(/#all#|#search#/g,"");let{drives,path}=get_drives_path(orid);const id=orid.endsWith("/")?orid:orid+"/";const list=drives.getPath(path);let subList=[];let vodFiles=[];let allList=[];let fl=filter?extend:{};if(fl.show){showMode=fl.show}list.forEach(item=>{if(drives.is_subt(item)){subList.push(item.name)}if(!drives.showAll&&!drives.isFolder(item)&&!drives.isVideo(item)){return}let vod_time=drives.getTime(item);let vod_size=get_size(item.size);let remark=vod_time.split(" ")[0].substr(3)+"\t"+vod_size;let vod_id=id+item.name+(drives.isFolder(item)?"/":"");if(showMode==="all"){vod_id+="#all#"}print(vod_id);const vod={vod_id:vod_id,vod_name:item.name.replaceAll("$","").replaceAll("#",""),vod_pic:drives.getPic(item),vod_time:vod_time,vod_size:item.size,vod_tag:drives.isFolder(item)?"folder":"file",vod_remarks:drives.isFolder(item)?remark+" 文件夹":remark};if(drives.isVideo(item)){vodFiles.push(vod)}allList.push(vod)});if(vodFiles.length===1&&subList.length>0){let sub;if(subList.length===1){sub=subList[0]}else{let subs=JSON.parse(JSON.stringify(subList));subs.sort((a,b)=>{let a_similar=(a.includes("chs")?100:0)+levenshteinDistance(a,vodFiles[0].vod_name);let b_similar=(b.includes("chs")?100:0)+levenshteinDistance(b,vodFiles[0].vod_name);if(a_similar>b_similar){return 1}else{return-1}});sub=subs.slice(-1)[0]}vodFiles[0].vod_id+="@@@"+sub;vodFiles[0].vod_remarks+="🏷️"}else{vodFiles.forEach(item=>{const lh=0;let sub;subList.forEach(s=>{const l=levenshteinDistance(s,item.vod_name);if(l>60&&l>lh){sub=s}});if(sub){item.vod_id+="@@@"+sub;item.vod_remarks+="🏷️"}})}if(fl.order){let key=fl.order.split("_").slice(0,-1).join("_");let order=fl.order.split("_").slice(-1)[0];print(`排序key:${key},排序order:${order}`);if(key.includes("name")){detail_order="name";allList=sortListByName(allList,key,order)}else if(key.includes("cn")){detail_order="cn";allList=sortListByCN(allList,"vod_name",order)}else if(key.includes("time")){detail_order="time";allList=sortListByTime(allList,key,order)}else if(key.includes("size")){detail_order="size";allList=sortListBySize(allList,key,order)}else if(fl.order.includes("none")){detail_order="none";print("不排序")}}else{if(detail_order!=="none"){allList=sortListByName(allList,"vod_name","asc")}}print("----category----"+`tid:${tid},detail_order:${detail_order},showMode:${showMode}`);return JSON.stringify({page:1,pagecount:1,limit:allList.length,total:allList.length,list:allList})}function getAll(otid,tid,drives,path){try{const content=category(tid,null,false,null);const isFile=isMedia(otid.replace(/#all#|#search#/g,"").split("@@@")[0]);const{list}=JSON.parse(content);let vod_play_url=[];list.forEach(x=>{if(x.vod_tag==="file"){let vid=x.vod_id.replace(/#all#|#search#/g,"");vod_play_url.push(`${x.vod_name}$${vid.substring(vid.indexOf("$")+1)}`)}});const pl=path.split("/").filter(it=>it);let vod_name=pl[pl.length-1]||drives.name;if(vod_name===drives.name){print(pl)}if(otid.includes("#search#")){vod_name+="[搜]"}let vod={vod_id:otid,vod_name:vod_name,type_name:"文件夹",vod_pic:"https://avatars.githubusercontent.com/u/97389433?s=120&v=4",vod_content:tid,vod_tag:"folder",vod_play_from:drives.name,vod_play_url:vod_play_url.join("#"),vod_remarks:drives.settings.title};print("----detail1----");print(vod);return JSON.stringify({list:[vod]})}catch(e){print(e.message);let list=[{vod_name:"无数据,防无限请求",type_name:"文件夹",vod_id:"no_data",vod_remarks:"不要点,会崩的",vod_pic:"https://ghproxy.com/https://raw.githubusercontent.com/hjdhnx/dr_py/main/404.jpg",vod_actor:e.message,vod_director:tid,vod_content:otid}];return JSON.stringify({list:list})}}function detail(tid){let isSearch=tid.includes("#search#");let isAll=tid.includes("#all#");let otid=tid;tid=tid.replace(/#all#|#search#/g,"");let isFile=isMedia(tid.split("@@@")[0]);print(`isFile:${tid}?${isFile}`);let{drives,path}=get_drives_path(tid);print(`drives:${drives},path:${path},`);if(path.endsWith("/")){return getAll(otid,tid,drives,path)}else{if(isSearch&&!isFile){return getAll(otid,tid,drives,path)}else if(isAll){let new_tid;if(isFile){new_tid=tid.split("/").slice(0,-1).join("/")+"/"}else{new_tid=tid}print(`全集模式 tid:${tid}=>tid:${new_tid}`);let{drives,path}=get_drives_path(new_tid);return getAll(otid,new_tid,drives,path)}else if(isFile){let paths=path.split("@@@");let vod_name=paths[0].substring(paths[0].lastIndexOf("/")+1);let vod_title=vod_name;if(otid.includes("#search#")){vod_title+="[搜]"}let vod={vod_id:otid,vod_name:vod_title,type_name:"文件",vod_pic:"https://avatars.githubusercontent.com/u/97389433?s=120&v=4",vod_content:tid,vod_play_from:drives.name,vod_play_url:vod_name+"$"+path,vod_remarks:drives.settings.title};print("----detail2----");print(vod);return JSON.stringify({list:[vod]})}else{return JSON.stringify({list:[]})}}}function play(flag,id,flags){const drives=get_drives(flag);const urls=id.split("@@@");let vod={parse:0,playUrl:"",url:drives.getFile(urls[0]).raw_url};if(urls.length>=2){const path=urls[0].substring(0,urls[0].lastIndexOf("/")+1);vod.subt=drives.getFile(path+urls[1]).raw_url1}print("----play----");print(vod);return JSON.stringify(vod)}function search(wd,quick){print(__drives);print("可搜索的alist驱动:"+searchDriver);if(!searchDriver||!wd){return JSON.stringify({list:[]})}else{let driver=__drives[searchDriver];wd=wd.split(" ").filter(it=>it.trim()).join("+");print(driver);let surl=driver.server+"/search?box="+wd+"&url=";if(search_type){surl+="&type="+search_type}print("搜索链接:"+surl);let html=http.get(surl).text();let lists=[];try{lists=pdfa(html,"div&&ul&&a")}catch(e){}print(`搜索结果数:${lists.length},搜索结果显示数量限制:${limit_search_show}`);let vods=[];let excludeReg=/\.(pdf|epub|mobi|txt|doc|lrc)$/;let cnt=0;lists.forEach(it=>{let vhref=pdfh(it,"a&&href");if(vhref){vhref=unescape(vhref)}if(excludeReg.test(vhref)){return}if(cnt1024*1024*1024*1024){sz/=1024*1024*1024*1024;filesize="TB"}else if(sz>1024*1024*1024){sz/=1024*1024*1024;filesize="GB"}else if(sz>1024*1024){sz/=1024*1024;filesize="MB"}else if(sz>1024){sz/=1024;filesize="KB"}else{filesize="B"}let sizeStr=sz.toFixed(2)+filesize,index=sizeStr.indexOf("."),dou=sizeStr.substr(index+1,2);if(dou==="00"){return sizeStr.substring(0,index)+sizeStr.substr(index+3,2)}else{return sizeStr}}function levenshteinDistance(str1,str2){return 100-100*distance(str1,str2)/Math.max(str1.length,str2.length)}function naturalSort(options){if(!options){options={}}return function(a,b){if(options.key){a=a[options.key];b=b[options.key]}var EQUAL=0;var GREATER=options.order==="desc"?-1:1;var SMALLER=-GREATER;var re=/(^-?[0-9]+(\.?[0-9]*)[df]?e?[0-9]?$|^0x[0-9a-f]+$|[0-9]+)/gi;var sre=/(^[ ]*|[ ]*$)/g;var dre=/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/;var hre=/^0x[0-9a-f]+$/i;var ore=/^0/;var normalize=function normalize(value){var string=""+value;return options.caseSensitive?string:string.toLowerCase()};var x=normalize(a).replace(sre,"")||"";var y=normalize(b).replace(sre,"")||"";var xN=x.replace(re,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0");var yN=y.replace(re,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0");if(!x&&!y)return EQUAL;if(!x&&y)return GREATER;if(x&&!y)return SMALLER;var xD=parseInt(x.match(hre))||xN.length!=1&&x.match(dre)&&Date.parse(x);var yD=parseInt(y.match(hre))||xD&&y.match(dre)&&Date.parse(y)||null;var oFxNcL,oFyNcL;if(yD){if(xDyD)return GREATER}for(var cLoc=0,numS=Math.max(xN.length,yN.length);cLocoFyNcL)return GREATER}return EQUAL}}const sortListByName=(vodList,key,order)=>{if(!key){return vodList}order=order||"asc";return vodList.sort(naturalSort({key:key,order:order,caseSensitive:true}))};const getTimeInt=timeStr=>{return new Date(timeStr).getTime()};const sortListByTime=(vodList,key,order)=>{if(!key){return vodList}let ASCarr=vodList.sort((a,b)=>{a=a[key];b=b[key];return getTimeInt(a)-getTimeInt(b)});if(order==="desc"){ASCarr.reverse()}return ASCarr};const sortListBySize=(vodList,key,order)=>{if(!key){return vodList}let ASCarr=vodList.sort((a,b)=>{a=a[key];b=b[key];return(Number(a)||0)-(Number(b)||0)});if(order==="desc"){ASCarr.reverse()}return ASCarr};export default{init:init,home:home,homeVod:homeVod,category:category,detail:detail,play:play,search:search}; \ No newline at end of file +import{distance}from"./mod.js";import{sortListByCN}from"./sortName.js";String.prototype.rstrip=function(chars){let regex=new RegExp(chars+"$");return this.replace(regex,"")};var showMode="single";var searchDriver="";var limit_search_show=200;var search_type="";var detail_order="name";var playRaw=1;const request_timeout=5e3;const VERSION="alist v2/v3 20221223";const UA="Mozilla/5.0";function print(any){any=any||"";if(typeof any=="object"&&Object.keys(any).length>0){try{any=JSON.stringify(any);console.log(any)}catch(e){console.log(typeof any+":"+any.length)}}else if(typeof any=="object"&&Object.keys(any).length<1){console.log("null object")}else{console.log(any)}}function getHome(url){if(!url){return""}let tmp=url.split("//");url=tmp[0]+"//"+tmp[1].split("/")[0];try{url=decodeURIComponent(url)}catch(e){}return url}const http=function(url,options={}){if(options.method==="POST"&&options.data){options.body=JSON.stringify(options.data);options.headers=Object.assign({"content-type":"application/json"},options.headers)}options.timeout=request_timeout;if(!options.headers){options.headers={}}let keys=Object.keys(options.headers).map(it=>it.toLowerCase());if(!keys.includes("referer")){options.headers["Referer"]=getHome(url)}if(!keys.includes("user-agent")){options.headers["User-Agent"]=UA}try{const res=req(url,options);res.json=()=>res&&res.content?JSON.parse(res.content):null;res.text=()=>res&&res.content?res.content:"";return res}catch(e){return{json(){return null},text(){return""}}}};["get","post"].forEach(method=>{http[method]=function(url,options={}){return http(url,Object.assign(options,{method:method.toUpperCase()}))}});const __drives={};function isMedia(file){return/\.(dff|dsf|mp3|aac|wav|wma|cda|flac|m4a|mid|mka|mp2|mpa|mpc|ape|ofr|ogg|ra|wv|tta|ac3|dts|tak|webm|wmv|mpeg|mov|ram|swf|mp4|avi|rm|rmvb|flv|mpg|mkv|m3u8|ts|3gp|asf)$/.test(file.toLowerCase())}function get_drives_path(tid){const index=tid.indexOf("$");const name=tid.substring(0,index);const path=tid.substring(index+1);return{drives:get_drives(name),path:path}}function get_drives(name){const{settings,api,server}=__drives[name];if(settings.v3==null){settings.v3=false;const data=http.get(server+"/api/public/settings").json().data;if(Array.isArray(data)){settings.title=data.find(x=>x.key==="title")?.value;settings.v3=false;settings.version=data.find(x=>x.key==="version")?.value;settings.enableSearch=data.find(x=>x.key==="enable search")?.value==="true"}else{settings.title=data.title;settings.v3=true;settings.version=data.version;settings.enableSearch=false}api.path=settings.v3?"/api/fs/list":"/api/public/path";api.file=settings.v3?"/api/fs/get":"/api/public/path";api.search=settings.v3?"/api/public/search":"/api/public/search"}return __drives[name]}function init(ext){console.log("当前版本号:"+VERSION);let data;if(typeof ext=="object"){data=ext;print("alist ext:object")}else if(typeof ext=="string"){if(ext.startsWith("http")){let alist_data=ext.split(";");let alist_data_url=alist_data[0];limit_search_show=alist_data.length>1?Number(alist_data[1])||limit_search_show:limit_search_show;search_type=alist_data.length>2?alist_data[2]:search_type;print(alist_data_url);data=http.get(alist_data_url).json()}else{print("alist ext:json string");data=JSON.parse(ext)}}let drives=[];if(Array.isArray(data)&&data.length>0&&data[0].hasOwnProperty("server")&&data[0].hasOwnProperty("name")){drives=data}else if(!Array.isArray(data)&&data.hasOwnProperty("drives")&&Array.isArray(data.drives)){drives=data.drives.filter(it=>it.type&&it.type==="alist"||!it.type)}print(drives);searchDriver=(drives.find(x=>x.search)||{}).name||"";if(!searchDriver&&drives.length>0){searchDriver=drives[0].name}print(searchDriver);drives.forEach(item=>{let _path_param=[];if(item.params){_path_param=Object.keys(item.params);_path_param.sort((a,b)=>a.length-b.length)}if(item.password){let pwdObj={password:item.password};if(!item.params){item.params={"/":pwdObj}}else{item.params["/"]=pwdObj}_path_param.unshift("/")}__drives[item.name]={name:item.name,server:item.server.endsWith("/")?item.server.rstrip("/"):item.server,startPage:item.startPage||"/",showAll:item.showAll===true,search:!!item.search,params:item.params||{},_path_param:_path_param,settings:{},api:{},getParams(path){const key=this._path_param.find(x=>path.startsWith(x));return Object.assign({},this.params[key],{path:path})},getPath(path){const res=http.post(this.server+this.api.path,{data:this.getParams(path)}).json();return this.settings.v3?res.data.content:res.data.files},getFile(path){let raw_url=this.server+"/d"+path;raw_url=encodeURI(raw_url);let data={raw_url:raw_url,raw_url1:raw_url};if(playRaw===1){try{const res=http.post(this.server+this.api.file,{data:this.getParams(path)}).json();data=this.settings.v3?res.data:res.data.files[0];if(!this.settings.v3){data.raw_url=data.url}data.raw_url1=raw_url;return data}catch(e){return data}}else{return data}},isFolder(data){return data.type===1},isVideo(data){return this.settings.v3?data.type===2||data.type===0||data.type===3:data.type===3||data.type===0||data.type===4},is_subt(data){if(data.type===1){return false}const ext=/\.(srt|ass|scc|stl|ttml)$/;return ext.test(data.name)},getPic(data){let pic=this.settings.v3?data.thumb:data.thumbnail;return pic||(this.isFolder(data)?"http://img1.3png.com/281e284a670865a71d91515866552b5f172b.png":"")},getTime(data,isStandard){isStandard=isStandard||false;try{let tTime=data.updated_at||data.time_str||data.modified||"";let date="";if(tTime){tTime=tTime.split("T");date=tTime[0];if(isStandard){date=date.replace(/-/g,"/")}tTime=tTime[1].split(/Z|\./);date+=" "+tTime[0]}return date}catch(e){return""}}}});print("init执行完毕")}function home(filter){let classes=Object.keys(__drives).map(key=>({type_id:`${key}$${__drives[key].startPage}`,type_name:key,type_flag:"1"}));let filter_dict={};let filters=[{key:"order",name:"排序",value:[{n:"名称⬆️",v:"vod_name_asc"},{n:"名称⬇️",v:"vod_name_desc"},{n:"中英⬆️",v:"vod_cn_asc"},{n:"中英⬇️",v:"vod_cn_desc"},{n:"时间⬆️",v:"vod_time_asc"},{n:"时间⬇️",v:"vod_time_desc"},{n:"大小⬆️",v:"vod_size_asc"},{n:"大小⬇️",v:"vod_size_desc"},{n:"无",v:"none"}]},{key:"show",name:"播放展示",value:[{n:"单集",v:"single"},{n:"全集",v:"all"}]}];classes.forEach(it=>{filter_dict[it.type_id]=filters});print("----home----");print(classes);return JSON.stringify({class:classes,filters:filter_dict})}function homeVod(params){let _post_data={pageNum:0,pageSize:100};let _post_url="https://pbaccess.video.qq.com/trpc.videosearch.hot_rank.HotRankServantHttp/HotRankHttp";let data=http.post(_post_url,{data:_post_data}).json();let _list=[];try{data=data["data"]["navItemList"][0]["hotRankResult"]["rankItemList"];data.forEach(it=>{_list.push({vod_name:it.title,vod_id:"msearch:"+it.title,vod_pic:"https://avatars.githubusercontent.com/u/97389433?s=120&v=4",vod_remarks:it.changeOrder})})}catch(e){print("Alist获取首页推荐发送错误:"+e.message)}return JSON.stringify({list:_list})}function category(tid,pg,filter,extend){let orid=tid.replace(/#all#|#search#/g,"");let{drives,path}=get_drives_path(orid);const id=orid.endsWith("/")?orid:orid+"/";const list=drives.getPath(path);let subList=[];let vodFiles=[];let allList=[];let fl=filter?extend:{};if(fl.show){showMode=fl.show}list.forEach(item=>{if(drives.is_subt(item)){subList.push(item.name)}if(!drives.showAll&&!drives.isFolder(item)&&!drives.isVideo(item)){return}let vod_time=drives.getTime(item);let vod_size=get_size(item.size);let remark=vod_time.split(" ")[0].substr(3)+"\t"+vod_size;let vod_id=id+item.name+(drives.isFolder(item)?"/":"");if(showMode==="all"){vod_id+="#all#"}print(vod_id);const vod={vod_id:vod_id,vod_name:item.name.replaceAll("$","").replaceAll("#",""),vod_pic:drives.getPic(item),vod_time:vod_time,vod_size:item.size,vod_tag:drives.isFolder(item)?"folder":"file",vod_remarks:drives.isFolder(item)?remark+" 文件夹":remark};if(drives.isVideo(item)){vodFiles.push(vod)}allList.push(vod)});if(vodFiles.length===1&&subList.length>0){let sub;if(subList.length===1){sub=subList[0]}else{let subs=JSON.parse(JSON.stringify(subList));subs.sort((a,b)=>{let a_similar=(a.includes("chs")?100:0)+levenshteinDistance(a,vodFiles[0].vod_name);let b_similar=(b.includes("chs")?100:0)+levenshteinDistance(b,vodFiles[0].vod_name);if(a_similar>b_similar){return 1}else{return-1}});sub=subs.slice(-1)[0]}vodFiles[0].vod_id+="@@@"+sub;vodFiles[0].vod_remarks+="🏷️"}else{vodFiles.forEach(item=>{const lh=0;let sub;subList.forEach(s=>{const l=levenshteinDistance(s,item.vod_name);if(l>60&&l>lh){sub=s}});if(sub){item.vod_id+="@@@"+sub;item.vod_remarks+="🏷️"}})}if(fl.order){let key=fl.order.split("_").slice(0,-1).join("_");let order=fl.order.split("_").slice(-1)[0];print(`排序key:${key},排序order:${order}`);if(key.includes("name")){detail_order="name";allList=sortListByName(allList,key,order)}else if(key.includes("cn")){detail_order="cn";allList=sortListByCN(allList,"vod_name",order)}else if(key.includes("time")){detail_order="time";allList=sortListByTime(allList,key,order)}else if(key.includes("size")){detail_order="size";allList=sortListBySize(allList,key,order)}else if(fl.order.includes("none")){detail_order="none";print("不排序")}}else{if(detail_order!=="none"){allList=sortListByName(allList,"vod_name","asc")}}print("----category----"+`tid:${tid},detail_order:${detail_order},showMode:${showMode}`);return JSON.stringify({page:1,pagecount:1,limit:allList.length,total:allList.length,list:allList})}function getAll(otid,tid,drives,path){try{const content=category(tid,null,false,null);const isFile=isMedia(otid.replace(/#all#|#search#/g,"").split("@@@")[0]);const{list}=JSON.parse(content);let vod_play_url=[];list.forEach(x=>{if(x.vod_tag==="file"){let vid=x.vod_id.replace(/#all#|#search#/g,"");vod_play_url.push(`${x.vod_name}$${vid.substring(vid.indexOf("$")+1)}`)}});const pl=path.split("/").filter(it=>it);let vod_name=pl[pl.length-1]||drives.name;if(vod_name===drives.name){print(pl)}if(otid.includes("#search#")){vod_name+="[搜]"}let vod={vod_id:otid,vod_name:vod_name,type_name:"文件夹",vod_pic:"https://avatars.githubusercontent.com/u/97389433?s=120&v=4",vod_content:tid,vod_tag:"folder",vod_play_from:drives.name,vod_play_url:vod_play_url.join("#"),vod_remarks:drives.settings.title};print("----detail1----");print(vod);return JSON.stringify({list:[vod]})}catch(e){print(e.message);let list=[{vod_name:"无数据,防无限请求",type_name:"文件夹",vod_id:"no_data",vod_remarks:"不要点,会崩的",vod_pic:"https://mirror.ghproxy.com/https://raw.githubusercontent.com/hjdhnx/dr_py/main/404.jpg",vod_actor:e.message,vod_director:tid,vod_content:otid}];return JSON.stringify({list:list})}}function detail(tid){let isSearch=tid.includes("#search#");let isAll=tid.includes("#all#");let otid=tid;tid=tid.replace(/#all#|#search#/g,"");let isFile=isMedia(tid.split("@@@")[0]);print(`isFile:${tid}?${isFile}`);let{drives,path}=get_drives_path(tid);print(`drives:${drives},path:${path},`);if(path.endsWith("/")){return getAll(otid,tid,drives,path)}else{if(isSearch&&!isFile){return getAll(otid,tid,drives,path)}else if(isAll){let new_tid;if(isFile){new_tid=tid.split("/").slice(0,-1).join("/")+"/"}else{new_tid=tid}print(`全集模式 tid:${tid}=>tid:${new_tid}`);let{drives,path}=get_drives_path(new_tid);return getAll(otid,new_tid,drives,path)}else if(isFile){let paths=path.split("@@@");let vod_name=paths[0].substring(paths[0].lastIndexOf("/")+1);let vod_title=vod_name;if(otid.includes("#search#")){vod_title+="[搜]"}let vod={vod_id:otid,vod_name:vod_title,type_name:"文件",vod_pic:"https://avatars.githubusercontent.com/u/97389433?s=120&v=4",vod_content:tid,vod_play_from:drives.name,vod_play_url:vod_name+"$"+path,vod_remarks:drives.settings.title};print("----detail2----");print(vod);return JSON.stringify({list:[vod]})}else{return JSON.stringify({list:[]})}}}function play(flag,id,flags){const drives=get_drives(flag);const urls=id.split("@@@");let vod={parse:0,playUrl:"",url:drives.getFile(urls[0]).raw_url};if(urls.length>=2){const path=urls[0].substring(0,urls[0].lastIndexOf("/")+1);vod.subt=drives.getFile(path+urls[1]).raw_url1}print("----play----");print(vod);return JSON.stringify(vod)}function search(wd,quick){print(__drives);print("可搜索的alist驱动:"+searchDriver);if(!searchDriver||!wd){return JSON.stringify({list:[]})}else{let driver=__drives[searchDriver];wd=wd.split(" ").filter(it=>it.trim()).join("+");print(driver);let surl=driver.server+"/search?box="+wd+"&url=";if(search_type){surl+="&type="+search_type}print("搜索链接:"+surl);let html=http.get(surl).text();let lists=[];try{lists=pdfa(html,"div&&ul&&a")}catch(e){}print(`搜索结果数:${lists.length},搜索结果显示数量限制:${limit_search_show}`);let vods=[];let excludeReg=/\.(pdf|epub|mobi|txt|doc|lrc)$/;let cnt=0;lists.forEach(it=>{let vhref=pdfh(it,"a&&href");if(vhref){vhref=unescape(vhref)}if(excludeReg.test(vhref)){return}if(cnt1024*1024*1024*1024){sz/=1024*1024*1024*1024;filesize="TB"}else if(sz>1024*1024*1024){sz/=1024*1024*1024;filesize="GB"}else if(sz>1024*1024){sz/=1024*1024;filesize="MB"}else if(sz>1024){sz/=1024;filesize="KB"}else{filesize="B"}let sizeStr=sz.toFixed(2)+filesize,index=sizeStr.indexOf("."),dou=sizeStr.substr(index+1,2);if(dou==="00"){return sizeStr.substring(0,index)+sizeStr.substr(index+3,2)}else{return sizeStr}}function levenshteinDistance(str1,str2){return 100-100*distance(str1,str2)/Math.max(str1.length,str2.length)}function naturalSort(options){if(!options){options={}}return function(a,b){if(options.key){a=a[options.key];b=b[options.key]}var EQUAL=0;var GREATER=options.order==="desc"?-1:1;var SMALLER=-GREATER;var re=/(^-?[0-9]+(\.?[0-9]*)[df]?e?[0-9]?$|^0x[0-9a-f]+$|[0-9]+)/gi;var sre=/(^[ ]*|[ ]*$)/g;var dre=/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/;var hre=/^0x[0-9a-f]+$/i;var ore=/^0/;var normalize=function normalize(value){var string=""+value;return options.caseSensitive?string:string.toLowerCase()};var x=normalize(a).replace(sre,"")||"";var y=normalize(b).replace(sre,"")||"";var xN=x.replace(re,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0");var yN=y.replace(re,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0");if(!x&&!y)return EQUAL;if(!x&&y)return GREATER;if(x&&!y)return SMALLER;var xD=parseInt(x.match(hre))||xN.length!=1&&x.match(dre)&&Date.parse(x);var yD=parseInt(y.match(hre))||xD&&y.match(dre)&&Date.parse(y)||null;var oFxNcL,oFyNcL;if(yD){if(xDyD)return GREATER}for(var cLoc=0,numS=Math.max(xN.length,yN.length);cLocoFyNcL)return GREATER}return EQUAL}}const sortListByName=(vodList,key,order)=>{if(!key){return vodList}order=order||"asc";return vodList.sort(naturalSort({key:key,order:order,caseSensitive:true}))};const getTimeInt=timeStr=>{return new Date(timeStr).getTime()};const sortListByTime=(vodList,key,order)=>{if(!key){return vodList}let ASCarr=vodList.sort((a,b)=>{a=a[key];b=b[key];return getTimeInt(a)-getTimeInt(b)});if(order==="desc"){ASCarr.reverse()}return ASCarr};const sortListBySize=(vodList,key,order)=>{if(!key){return vodList}let ASCarr=vodList.sort((a,b)=>{a=a[key];b=b[key];return(Number(a)||0)-(Number(b)||0)});if(order==="desc"){ASCarr.reverse()}return ASCarr};export default{init:init,home:home,homeVod:homeVod,category:category,detail:detail,play:play,search:search}; \ No newline at end of file