import { Crypto, load, _ } from './lib/cat.js'; let siteUrl = 'http://www.88kanqiu.one'; let siteKey = ''; let siteType = 0; let headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36' }; async function request(reqUrl, postData, agentSp, get) { let res = await req(reqUrl, { method: get ? 'get' : 'post', headers: headers, data: postData || {}, postType: get ? '' : 'form', }); let content = res.content; return content; } async function get(reqUrl) { let res = await req(reqUrl, { method: 'get', headers: headers }); let content = res.content; return content; } async function init(cfg) { siteKey = cfg.skey; siteType = cfg.stype; if(cfg.ext) { siteUrl = cfg.ext; } } async function home(filter) { let classes = [{ type_id: '0', type_name: '全部直播', },{ type_id: '1', type_name: '篮球直播', },{ type_id: '8', type_name: '足球直播', },{ type_id: '29', type_name: '其他直播', }]; let filterObj = genFilterObj(); return JSON.stringify({ class: classes, filters: filterObj }); } async function category(tid, pg, filter, extend) { if(pg <=0) pg = 1; let cateId = tid == '0'?'':tid; if (extend['cateId']) { cateId = extend['cateId']; } let url = siteUrl; if (cateId != '') { url = url + '/match/' + cateId + '/live'; } const html = await get(url); const $ = load(html); let videos = []; let cards = $('.list-group-item'); for(let i=0;i a')[0]).text().trim(); let name = ''; if (time != '') { name = time + ' ' + gameType + ' ' + teamOne + ' VS ' + teamTwo + ' ' + liveStatus; } else { name = $(n).text().replaceAll('\n', '').trim(); } let pic = $($(n).find('.col-xs-1 > img')[0]).attr('src'); if(!pic || pic == '') pic = 'http://www.88kanqiu.one/static/img/default-img.png'; if(pic.indexOf('http') < 0) pic = siteUrl + pic; let remark = $($(n).find('.btn.btn-primary')).text(); if (extend['livingStatus'] != '1' || (extend['livingStatus'] === '1' && remark.length > 0)) { videos.push({ vod_id: vid == ''?name:vid, vod_name: name, vod_pic: pic, vod_remarks: remark }); } }; return JSON.stringify({ list: videos, page: 1, pagecount: 1, limit: 0, total: videos.length }); } async function detail(id) { try { if(id.indexOf('http') < 0) { return '{}'; } const $ = load(await get(id)); const dataStr = $('input#t').attr('value'); const data = JSON.parse(base64Decode(dataStr.substring(0,dataStr.length-2).substring(6))).links; console.log('data', data); let playUrls = []; data.forEach(item => { let name = item['name']; let playUrl = item['url']; playUrls.push(name + '$' + encodeURIComponent(playUrl)); }); const video = { vod_id: id, vod_play_from: 'Leospring', vod_play_url: playUrls.join('#') }; const list = [video]; const result = { list }; return JSON.stringify(result); } catch (e) { console.log('err', e); } return null; } async function play(flag, id, flags) { return JSON.stringify(await getPlayObj(id)); } async function getPlayObj(id) { if(id.indexOf('?url=') > 0) { return {parse: 0, url: id.split('?url=')[1]} } if(id.indexOf('replayer') > 0) { let url = 'https://dszbok.com/prod-api/match/detail?mid=' + id.split('id=')[1] + '&pid=7&langtype=vi&zoneld=Asia/Shanghai'; let playUrl = JSON.parse(await get(url)).data.matchinfo.live_urls[0].url; return {parse: 0, url: playUrl} } if (id.indexOf('live.jpyex.com/player') > 0) { let url = id.replace('player/play.html', 'api/index/live'); let playUrl = Object.values(JSON.parse(await get(url)).detail.play_url)[0].pCode.m3u8; return {parse: 0, url: playUrl} } if(id.indexOf('sportsteam1234') > 0) { let playUrl = await parseSportSteam1234(id); let parse = 0; if (!playUrl.startsWith('http')) { playUrl = id; parse = 1; } return { parse: parse, url: playUrl, header: { 'User-Agent': headers['User-Agent'], 'Referer': 'http://play.sportsteam1234.com/', 'Accept': '*/*' } } } if(id.indexOf('sportsteam363') > 0) { let playUrl = await parseSportSteam363(id); let parse = 0; if (!playUrl.startsWith('http')) { playUrl = id; parse = 1; } return { parse: parse, url: playUrl, header: { 'User-Agent': headers['User-Agent'], 'Referer': 'http://play.sportsteam363.com/', 'Accept': '*/*' } } } if(id.indexOf('play.926.tv') > 0) { let playUrl = await parse926Tv(id); return { parse: 0, url: playUrl, header: { 'User-Agent': headers['User-Agent'], 'Referer': 'http://play.926.tv/', 'Accept': '*/*' } } } return {parse: 1, url: id,}; } async function parseSportSteam1234(url) { let key = 'toStringtoString'; let iv = '2202030405060719'; if (url.indexOf('gm.php') > 0 || url.indexOf('kbm.php') > 0) { url = url.replace('gm.php', 'kbm.php'); const html = await get(url); const $ = load(html); for(const n of $('script')) { const text = $(n).text(); if(text.indexOf('encryptedBase64Str') > 0) { let str = text.split("var encryptedBase64Str = '")[1].split("';")[0]; return decodeURIComponent(aesDecode(str, key, iv)); } } } return ''; } async function parseSportSteam363(url) { if (url.indexOf('gm.php') > 0 || url.indexOf('kbm.php') > 0) { url = url.replace('gm.php', 'kbm.php'); } const html = await get(url); const $ = load(html); let key = 'toStringtoString'; let iv = '0000000000000000'; for(const n of $('script')) { const text = $(n).text(); if(text.indexOf('encryptedBase64Str') > 0) { let str = text.split("var encryptedBase64Str = '")[1].split("';")[0]; return 'http:' + decodeURIComponent(aesDecode(str, key, iv)); } } return ''; } async function parse926Tv(url) { const html = await get(url); const $ = load(html); let str = $('div#a1 > span').attr('no-zw-zxx'); str = base64Decode(decode926Tv(str)); str = 'http:' + decodeURIComponent(decode926Tv(str)); return str; } function decode926Tv(str){ var arr = []; for(var i=0;i