mirror of
https://github.com/alantang1977/X.git
synced 2024-11-06 06:53:21 +02:00
1 line
No EOL
1.4 KiB
JavaScript
1 line
No EOL
1.4 KiB
JavaScript
import{Crypto,load,_}from"assets://js/lib/cat.js";let key="xiaoya-tv",url="",siteKey="",siteType=0;const UA="Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1",cookie={};async function request(reqUrl,referer,mth,data,hd){var headers={"User-Agent":UA,Cookie:_.map(cookie,(value,key)=>key+"="+value).join(";")},referer=(referer&&(headers.referer=encodeURIComponent(referer)),await req(reqUrl,{method:mth||"get",headers:headers,data:data,postType:"post"===mth?"form":""}));return referer.content}async function init(cfg){siteKey=cfg.skey,siteType=cfg.stype,url=cfg.ext}async function home(filter){return(await request(url)).replaceAll("1$/$1","1$/$0")}async function homeVod(){return"{}"}async function category(tid,pg,filter,extend){pg<=0&&(pg=1);let api=url+"?t="+tid+"&pg="+pg;return extend&&(tid=Object.entries(extend).map(([key,val]=entry)=>"&"+key+"="+val),api=(api+=tid)+("&f="+encodeURIComponent(JSON.stringify(extend)))),request(api)}async function detail(id){id=id.split("$");return request(url+"?ids="+id[0]+"$"+id[1])}async function play(flag,id,flags){return request(url.replace("/vod1","/play")+"?id="+id+"&from=open")}async function search(wd,quick){return request(url+"?wd="+wd)}function __jsEvalReturn(){return{init:init,home:home,homeVod:homeVod,category:category,detail:detail,play:play,search:search}}export{__jsEvalReturn}; |