Add files via upload
This commit is contained in:
parent
9aabd3da7e
commit
154b15d0e4
166
JN/EXT/OPENJS/duboku_open.js
Normal file
166
JN/EXT/OPENJS/duboku_open.js
Normal file
@ -0,0 +1,166 @@
|
||||
import { Crypto, load, _, jinja2 } from './lib/cat.js';
|
||||
|
||||
let key = 'duboku';
|
||||
let url = 'https://u.duboku.io';
|
||||
let siteKey = '';
|
||||
let 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';
|
||||
|
||||
async function request(reqUrl, agentSp) {
|
||||
let res = await req(reqUrl, {
|
||||
method: 'get',
|
||||
headers: {
|
||||
'User-Agent': agentSp || UA,
|
||||
'Referer': url
|
||||
},
|
||||
});
|
||||
return res.content;
|
||||
}
|
||||
|
||||
// cfg = {skey: siteKey, ext: extend}
|
||||
async function init(cfg) {
|
||||
siteKey = cfg.skey;
|
||||
siteType = cfg.stype;
|
||||
}
|
||||
|
||||
async function home(filter) {
|
||||
const html = await request(url);
|
||||
const $ = load(html);
|
||||
const class_parse = $('ul.nav-list > li > a[href*=vodtype]');
|
||||
let classes = [];
|
||||
classes = _.map(class_parse, (cls) => {
|
||||
let typeId = cls.attribs['href'];
|
||||
typeId = typeId.substring(typeId.lastIndexOf('/') + 1).replace('.html','');
|
||||
return {
|
||||
type_id: typeId,
|
||||
type_name: cls.children[0].data,
|
||||
};
|
||||
});
|
||||
let filterObj = {
|
||||
"2":[{"key":"cateId","name":"类型","value":[{"n":"全部","v":"2"},{"n":"陆剧","v":"13"},{"n":"日韩剧","v":"15"},{"n":"短剧","v":"21"},{"n":"台泰剧","v":"14"},{"n":"港剧","v":"20"}]},{"key":"class","name":"剧情","value":[{"n":"全部","v":""},{"n":"悬疑","v":"悬疑"},{"n":"武侠","v":"武侠"},{"n":"科幻","v":"科幻"},{"n":"都市","v":"都市"},{"n":"爱情","v":"爱情"},{"n":"古装","v":"古装"},{"n":"战争","v":"战争"},{"n":"青春","v":"青春"},{"n":"偶像","v":"偶像"},{"n":"喜剧","v":"喜剧"},{"n":"家庭","v":"家庭"},{"n":"犯罪","v":"犯罪"},{"n":"奇幻","v":"奇幻"},{"n":"剧情","v":"剧情"},{"n":"乡村","v":"乡村"},{"n":"年代","v":"年代"},{"n":"警匪","v":"警匪"},{"n":"谍战","v":"谍战"},{"n":"冒险","v":"冒险"},{"n":"罪案","v":"罪案"},{"n":"宫廷","v":"宫廷"},{"n":"BL","v":"BL"}]},{"key":"area","name":"地区","value":[{"n":"全部","v":""},{"n":"内地","v":"内地"},{"n":"韩国","v":"韩国"},{"n":"香港","v":"香港"},{"n":"台湾","v":"台湾"},{"n":"美国","v":"美国"},{"n":"英国","v":"英国"},{"n":"巴西","v":"巴西"},{"n":"泰国","v":"泰国"},{"n":"法国","v":"法国"},{"n":"日本","v":"日本"},{"n":"荷兰","v":"荷兰"}]},{"key":"year","name":"年份","value":[{"n":"全部","v":""},{"n":"2023","v":"2023"},{"n":"2022","v":"2022"},{"n":"2021","v":"2021"},{"n":"2020","v":"2020"},{"n":"2019","v":"2019"},{"n":"2018","v":"2018"},{"n":"2017","v":"2017"}]},{"key":"lang","name":"语言","value":[{"n":"全部","v":""},{"n":"国语","v":"国语"},{"n":"英语","v":"英语"},{"n":"粤语","v":"粤语"},{"n":"韩语","v":"韩语"},{"n":"泰语","v":"泰语"},{"n":"法语","v":"法语"},{"n":"日语","v":"日语"}]},{"key":"letter","name":"字母","value":[{"n":"全部","v":""},{"n":"A","v":"A"},{"n":"B","v":"B"},{"n":"C","v":"C"},{"n":"D","v":"D"},{"n":"E","v":"E"},{"n":"F","v":"F"},{"n":"G","v":"G"},{"n":"H","v":"H"},{"n":"I","v":"I"},{"n":"J","v":"J"},{"n":"K","v":"K"},{"n":"L","v":"L"},{"n":"M","v":"M"},{"n":"N","v":"N"},{"n":"O","v":"O"},{"n":"P","v":"P"},{"n":"Q","v":"Q"},{"n":"R","v":"R"},{"n":"S","v":"S"},{"n":"T","v":"T"},{"n":"U","v":"U"},{"n":"V","v":"V"},{"n":"W","v":"W"},{"n":"X","v":"X"},{"n":"Y","v":"Y"},{"n":"Z","v":"Z"}]},{"key":"by","name":"排序","value":[{"n":"时间","v":"time"},{"n":"人气","v":"hits"},{"n":"评分","v":"score"}]}],
|
||||
"3":[{"key":"class","name":"剧情","value":[{"n":"全部","v":""},{"n":"真人秀","v":"真人秀"},{"n":"选秀","v":"选秀"},{"n":"竞演","v":"竞演"},{"n":"情感","v":"情感"},{"n":"访谈","v":"访谈"},{"n":"播报","v":"播报"},{"n":"旅游","v":"旅游"},{"n":"音乐","v":"音乐"},{"n":"美食","v":"美食"},{"n":"纪实","v":"纪实"},{"n":"曲艺","v":"曲艺"},{"n":"生活","v":"生活"},{"n":"游戏互动","v":"游戏互动"}]},{"key":"area","name":"地区","value":[{"n":"全部","v":""},{"n":"内地","v":"内地"},{"n":"香港","v":"香港"},{"n":"台湾","v":"台湾"},{"n":"韩国","v":"韩国"},{"n":"美国","v":"美国"}]},{"key":"year","name":"年份","value":[{"n":"全部","v":""},{"n":"2023","v":"2023"},{"n":"2022","v":"2022"},{"n":"2021","v":"2021"},{"n":"2020","v":"2020"},{"n":"2019","v":"2019"}]},{"key":"lang","name":"语言","value":[{"n":"全部","v":""},{"n":"国语","v":"国语"},{"n":"英语","v":"英语"},{"n":"粤语","v":"粤语"},{"n":"闽南语","v":"闽南语"},{"n":"韩语","v":"韩语"},{"n":"日语","v":"日语"},{"n":"其它","v":"其它"}]},{"key":"letter","name":"字母","value":[{"n":"全部","v":""},{"n":"A","v":"A"},{"n":"B","v":"B"},{"n":"C","v":"C"},{"n":"D","v":"D"},{"n":"E","v":"E"},{"n":"F","v":"F"},{"n":"G","v":"G"},{"n":"H","v":"H"},{"n":"I","v":"I"},{"n":"J","v":"J"},{"n":"K","v":"K"},{"n":"L","v":"L"},{"n":"M","v":"M"},{"n":"N","v":"N"},{"n":"O","v":"O"},{"n":"P","v":"P"},{"n":"Q","v":"Q"},{"n":"R","v":"R"},{"n":"S","v":"S"},{"n":"T","v":"T"},{"n":"U","v":"U"},{"n":"V","v":"V"},{"n":"W","v":"W"},{"n":"X","v":"X"},{"n":"Y","v":"Y"},{"n":"Z","v":"Z"}]},{"key":"by","name":"排序","value":[{"n":"时间","v":"time"},{"n":"人气","v":"hits"},{"n":"评分","v":"score"}]}],
|
||||
"4":[{"key":"class","name":"剧情","value":[{"n":"全部","v":""},{"n":"玄幻","v":"玄幻"},{"n":"武侠","v":"武侠"},{"n":"情感","v":"情感"},{"n":"科幻","v":"科幻"},{"n":"热血","v":"热血"},{"n":"推理","v":"推理"},{"n":"搞笑","v":"搞笑"},{"n":"冒险","v":"冒险"},{"n":"萝莉","v":"萝莉"},{"n":"校园","v":"校园"},{"n":"动作","v":"动作"},{"n":"机战","v":"机战"},{"n":"运动","v":"运动"},{"n":"战争","v":"战争"},{"n":"少年","v":"少年"},{"n":"少女","v":"少女"},{"n":"社会","v":"社会"},{"n":"亲子","v":"亲子"},{"n":"益智","v":"益智"},{"n":"励志","v":"励志"},{"n":"其他","v":"其他"}]},{"key":"area","name":"地区","value":[{"n":"全部","v":""},{"n":"国产","v":"国产"},{"n":"日本","v":"日本"},{"n":"美国","v":"美国"},{"n":"法国","v":"法国"},{"n":"其他","v":"其他"}]},{"key":"year","name":"年份","value":[{"n":"全部","v":""},{"n":"2023","v":"2023"},{"n":"2022","v":"2022"},{"n":"2021","v":"2021"},{"n":"2020","v":"2020"},{"n":"2019","v":"2019"},{"n":"2018","v":"2018"},{"n":"2017","v":"2017"}]},{"key":"lang","name":"语言","value":[{"n":"全部","v":""},{"n":"国语","v":"国语"},{"n":"英语","v":"英语"},{"n":"粤语","v":"粤语"},{"n":"闽南语","v":"闽南语"},{"n":"韩语","v":"韩语"},{"n":"日语","v":"日语"},{"n":"其它","v":"其它"}]},{"key":"letter","name":"字母","value":[{"n":"全部","v":""},{"n":"A","v":"A"},{"n":"B","v":"B"},{"n":"C","v":"C"},{"n":"D","v":"D"},{"n":"E","v":"E"},{"n":"F","v":"F"},{"n":"G","v":"G"},{"n":"H","v":"H"},{"n":"I","v":"I"},{"n":"J","v":"J"},{"n":"K","v":"K"},{"n":"L","v":"L"},{"n":"M","v":"M"},{"n":"N","v":"N"},{"n":"O","v":"O"},{"n":"P","v":"P"},{"n":"Q","v":"Q"},{"n":"R","v":"R"},{"n":"S","v":"S"},{"n":"T","v":"T"},{"n":"U","v":"U"},{"n":"V","v":"V"},{"n":"W","v":"W"},{"n":"X","v":"X"},{"n":"Y","v":"Y"},{"n":"Z","v":"Z"}]},{"key":"by","name":"排序","value":[{"n":"时间","v":"time"},{"n":"人气","v":"hits"},{"n":"评分","v":"score"}]}],
|
||||
"13":[{"key":"class","name":"剧情","value":[{"n":"全部","v":""},{"n":"悬疑","v":"悬疑"},{"n":"武侠","v":"武侠"},{"n":"科幻","v":"科幻"},{"n":"都市","v":"都市"},{"n":"爱情","v":"爱情"},{"n":"古装","v":"古装"},{"n":"战争","v":"战争"},{"n":"青春","v":"青春"},{"n":"偶像","v":"偶像"},{"n":"喜剧","v":"喜剧"},{"n":"家庭","v":"家庭"},{"n":"犯罪","v":"犯罪"},{"n":"奇幻","v":"奇幻"},{"n":"剧情","v":"剧情"},{"n":"乡村","v":"乡村"},{"n":"年代","v":"年代"},{"n":"警匪","v":"警匪"},{"n":"谍战","v":"谍战"},{"n":"冒险","v":"冒险"},{"n":"罪案","v":"罪案"},{"n":"宫廷","v":"宫廷"},{"n":"BL","v":"BL"}]},{"key":"year","name":"年份","value":[{"n":"全部","v":""},{"n":"2023","v":"2023"},{"n":"2022","v":"2022"},{"n":"2021","v":"2021"},{"n":"2020","v":"2020"},{"n":"2019","v":"2019"},{"n":"2018","v":"2018"},{"n":"2017","v":"2017"}]},{"key":"letter","name":"字母","value":[{"n":"全部","v":""},{"n":"A","v":"A"},{"n":"B","v":"B"},{"n":"C","v":"C"},{"n":"D","v":"D"},{"n":"E","v":"E"},{"n":"F","v":"F"},{"n":"G","v":"G"},{"n":"H","v":"H"},{"n":"I","v":"I"},{"n":"J","v":"J"},{"n":"K","v":"K"},{"n":"L","v":"L"},{"n":"M","v":"M"},{"n":"N","v":"N"},{"n":"O","v":"O"},{"n":"P","v":"P"},{"n":"Q","v":"Q"},{"n":"R","v":"R"},{"n":"S","v":"S"},{"n":"T","v":"T"},{"n":"U","v":"U"},{"n":"V","v":"V"},{"n":"W","v":"W"},{"n":"X","v":"X"},{"n":"Y","v":"Y"},{"n":"Z","v":"Z"}]},{"key":"by","name":"排序","value":[{"n":"时间","v":"time"},{"n":"人气","v":"hits"},{"n":"评分","v":"score"}]}],
|
||||
"15":[{"key":"class","name":"剧情","value":[{"n":"全部","v":""},{"n":"悬疑","v":"悬疑"},{"n":"武侠","v":"武侠"},{"n":"科幻","v":"科幻"},{"n":"都市","v":"都市"},{"n":"爱情","v":"爱情"},{"n":"古装","v":"古装"},{"n":"战争","v":"战争"},{"n":"青春","v":"青春"},{"n":"偶像","v":"偶像"},{"n":"喜剧","v":"喜剧"},{"n":"家庭","v":"家庭"},{"n":"犯罪","v":"犯罪"},{"n":"奇幻","v":"奇幻"},{"n":"剧情","v":"剧情"},{"n":"乡村","v":"乡村"},{"n":"年代","v":"年代"},{"n":"警匪","v":"警匪"},{"n":"谍战","v":"谍战"},{"n":"冒险","v":"冒险"},{"n":"罪案","v":"罪案"},{"n":"宫廷","v":"宫廷"},{"n":"BL","v":"BL"}]},{"key":"area","name":"地区","value":[{"n":"全部","v":""},{"n":"韩国","v":"韩国"},{"n":"日本","v":"日本"}]},{"key":"year","name":"年份","value":[{"n":"全部","v":""},{"n":"2023","v":"2023"},{"n":"2022","v":"2022"},{"n":"2021","v":"2021"},{"n":"2020","v":"2020"},{"n":"2019","v":"2019"},{"n":"2018","v":"2018"},{"n":"2017","v":"2017"}]},{"key":"letter","name":"字母","value":[{"n":"全部","v":""},{"n":"A","v":"A"},{"n":"B","v":"B"},{"n":"C","v":"C"},{"n":"D","v":"D"},{"n":"E","v":"E"},{"n":"F","v":"F"},{"n":"G","v":"G"},{"n":"H","v":"H"},{"n":"I","v":"I"},{"n":"J","v":"J"},{"n":"K","v":"K"},{"n":"L","v":"L"},{"n":"M","v":"M"},{"n":"N","v":"N"},{"n":"O","v":"O"},{"n":"P","v":"P"},{"n":"Q","v":"Q"},{"n":"R","v":"R"},{"n":"S","v":"S"},{"n":"T","v":"T"},{"n":"U","v":"U"},{"n":"V","v":"V"},{"n":"W","v":"W"},{"n":"X","v":"X"},{"n":"Y","v":"Y"},{"n":"Z","v":"Z"}]},{"key":"by","name":"排序","value":[{"n":"时间","v":"time"},{"n":"人气","v":"hits"},{"n":"评分","v":"score"}]}],
|
||||
"21":[{"key":"class","name":"剧情","value":[{"n":"全部","v":""},{"n":"悬疑","v":"悬疑"},{"n":"武侠","v":"武侠"},{"n":"科幻","v":"科幻"},{"n":"都市","v":"都市"},{"n":"爱情","v":"爱情"},{"n":"古装","v":"古装"},{"n":"战争","v":"战争"},{"n":"青春","v":"青春"},{"n":"偶像","v":"偶像"},{"n":"喜剧","v":"喜剧"},{"n":"家庭","v":"家庭"},{"n":"犯罪","v":"犯罪"},{"n":"奇幻","v":"奇幻"},{"n":"剧情","v":"剧情"},{"n":"乡村","v":"乡村"},{"n":"年代","v":"年代"},{"n":"警匪","v":"警匪"},{"n":"谍战","v":"谍战"},{"n":"冒险","v":"冒险"},{"n":"罪案","v":"罪案"},{"n":"宫廷","v":"宫廷"},{"n":"BL","v":"BL"}]},{"key":"year","name":"年份","value":[{"n":"全部","v":""},{"n":"2023","v":"2023"},{"n":"2022","v":"2022"},{"n":"2021","v":"2021"},{"n":"2020","v":"2020"},{"n":"2019","v":"2019"},{"n":"2018","v":"2018"},{"n":"2017","v":"2017"}]},{"key":"letter","name":"字母","value":[{"n":"全部","v":""},{"n":"A","v":"A"},{"n":"B","v":"B"},{"n":"C","v":"C"},{"n":"D","v":"D"},{"n":"E","v":"E"},{"n":"F","v":"F"},{"n":"G","v":"G"},{"n":"H","v":"H"},{"n":"I","v":"I"},{"n":"J","v":"J"},{"n":"K","v":"K"},{"n":"L","v":"L"},{"n":"M","v":"M"},{"n":"N","v":"N"},{"n":"O","v":"O"},{"n":"P","v":"P"},{"n":"Q","v":"Q"},{"n":"R","v":"R"},{"n":"S","v":"S"},{"n":"T","v":"T"},{"n":"U","v":"U"},{"n":"V","v":"V"},{"n":"W","v":"W"},{"n":"X","v":"X"},{"n":"Y","v":"Y"},{"n":"Z","v":"Z"}]},{"key":"by","name":"排序","value":[{"n":"时间","v":"time"},{"n":"人气","v":"hits"},{"n":"评分","v":"score"}]}],
|
||||
"14":[{"key":"class","name":"剧情","value":[{"n":"全部","v":""},{"n":"悬疑","v":"悬疑"},{"n":"武侠","v":"武侠"},{"n":"科幻","v":"科幻"},{"n":"都市","v":"都市"},{"n":"爱情","v":"爱情"},{"n":"古装","v":"古装"},{"n":"战争","v":"战争"},{"n":"青春","v":"青春"},{"n":"偶像","v":"偶像"},{"n":"喜剧","v":"喜剧"},{"n":"家庭","v":"家庭"},{"n":"犯罪","v":"犯罪"},{"n":"奇幻","v":"奇幻"},{"n":"剧情","v":"剧情"},{"n":"乡村","v":"乡村"},{"n":"年代","v":"年代"},{"n":"警匪","v":"警匪"},{"n":"谍战","v":"谍战"},{"n":"冒险","v":"冒险"},{"n":"罪案","v":"罪案"},{"n":"宫廷","v":"宫廷"},{"n":"BL","v":"BL"}]},{"key":"area","name":"地区","value":[{"n":"全部","v":""},{"n":"台湾","v":"台湾"},{"n":"泰国","v":"泰国"}]},{"key":"year","name":"年份","value":[{"n":"全部","v":""},{"n":"2023","v":"2023"},{"n":"2022","v":"2022"},{"n":"2021","v":"2021"},{"n":"2020","v":"2020"},{"n":"2019","v":"2019"},{"n":"2018","v":"2018"},{"n":"2017","v":"2017"}]},{"key":"letter","name":"字母","value":[{"n":"全部","v":""},{"n":"A","v":"A"},{"n":"B","v":"B"},{"n":"C","v":"C"},{"n":"D","v":"D"},{"n":"E","v":"E"},{"n":"F","v":"F"},{"n":"G","v":"G"},{"n":"H","v":"H"},{"n":"I","v":"I"},{"n":"J","v":"J"},{"n":"K","v":"K"},{"n":"L","v":"L"},{"n":"M","v":"M"},{"n":"N","v":"N"},{"n":"O","v":"O"},{"n":"P","v":"P"},{"n":"Q","v":"Q"},{"n":"R","v":"R"},{"n":"S","v":"S"},{"n":"T","v":"T"},{"n":"U","v":"U"},{"n":"V","v":"V"},{"n":"W","v":"W"},{"n":"X","v":"X"},{"n":"Y","v":"Y"},{"n":"Z","v":"Z"}]},{"key":"by","name":"排序","value":[{"n":"时间","v":"time"},{"n":"人气","v":"hits"},{"n":"评分","v":"score"}]}],
|
||||
"20":[{"key":"class","name":"剧情","value":[{"n":"全部","v":""},{"n":"悬疑","v":"悬疑"},{"n":"武侠","v":"武侠"},{"n":"科幻","v":"科幻"},{"n":"都市","v":"都市"},{"n":"爱情","v":"爱情"},{"n":"古装","v":"古装"},{"n":"战争","v":"战争"},{"n":"青春","v":"青春"},{"n":"偶像","v":"偶像"},{"n":"喜剧","v":"喜剧"},{"n":"家庭","v":"家庭"},{"n":"犯罪","v":"犯罪"},{"n":"奇幻","v":"奇幻"},{"n":"剧情","v":"剧情"},{"n":"乡村","v":"乡村"},{"n":"年代","v":"年代"},{"n":"警匪","v":"警匪"},{"n":"谍战","v":"谍战"},{"n":"冒险","v":"冒险"},{"n":"罪案","v":"罪案"},{"n":"宫廷","v":"宫廷"},{"n":"BL","v":"BL"}]},{"key":"year","name":"年份","value":[{"n":"全部","v":""},{"n":"2023","v":"2023"},{"n":"2022","v":"2022"},{"n":"2021","v":"2021"},{"n":"2020","v":"2020"},{"n":"2019","v":"2019"},{"n":"2018","v":"2018"},{"n":"2017","v":"2017"}]},{"key":"letter","name":"字母","value":[{"n":"全部","v":""},{"n":"A","v":"A"},{"n":"B","v":"B"},{"n":"C","v":"C"},{"n":"D","v":"D"},{"n":"E","v":"E"},{"n":"F","v":"F"},{"n":"G","v":"G"},{"n":"H","v":"H"},{"n":"I","v":"I"},{"n":"J","v":"J"},{"n":"K","v":"K"},{"n":"L","v":"L"},{"n":"M","v":"M"},{"n":"N","v":"N"},{"n":"O","v":"O"},{"n":"P","v":"P"},{"n":"Q","v":"Q"},{"n":"R","v":"R"},{"n":"S","v":"S"},{"n":"T","v":"T"},{"n":"U","v":"U"},{"n":"V","v":"V"},{"n":"W","v":"W"},{"n":"X","v":"X"},{"n":"Y","v":"Y"},{"n":"Z","v":"Z"}]},{"key":"by","name":"排序","value":[{"n":"时间","v":"time"},{"n":"人气","v":"hits"},{"n":"评分","v":"score"}]}]
|
||||
};
|
||||
|
||||
return JSON.stringify({
|
||||
class: classes,
|
||||
filters: filterObj,
|
||||
});
|
||||
}
|
||||
|
||||
async function homeVod() {
|
||||
const link = url + '/vodshow/2--hits---------.html';
|
||||
const html = await request(link);
|
||||
const $ = load(html);
|
||||
const items = $('div.myui-panel_bd > ul.myui-vodlist > li');
|
||||
let videos = _.map(items, (item) => {
|
||||
const it = $(item).find('a:first')[0];
|
||||
const remarks = $($(item).find('span.pic-text')[0]).text().trim();
|
||||
return {
|
||||
vod_id: it.attribs.href.replace(/.*?\/voddetail\/(.*).html/g, '$1'),
|
||||
vod_name: it.attribs.title,
|
||||
vod_pic: it.attribs['data-original'],
|
||||
vod_remarks: remarks || '',
|
||||
};
|
||||
});
|
||||
return JSON.stringify({
|
||||
list: videos,
|
||||
});
|
||||
}
|
||||
|
||||
async function category(tid, pg, filter, extend) {
|
||||
if (pg <= 0) pg = 1;
|
||||
|
||||
const link = url + '/vodshow/' + (extend.CateId || tid) + '-'+(extend.area || '')+'-'+(extend.by || 'time')+'-'+(extend.class || '')+'-'+(extend.lang || '')+'-'+(extend.letter || '')+'---' + (`${pg}`) + '---'+(extend.year || '')+'.html';
|
||||
const html = await request(link);
|
||||
const $ = load(html);
|
||||
const items = $('div.myui-panel_bd > ul.myui-vodlist > li');
|
||||
let videos = _.map(items, (item) => {
|
||||
const it = $(item).find('a:first')[0];
|
||||
const remarks = $($(item).find('span.pic-text')[0]).text().trim();
|
||||
return {
|
||||
vod_id: it.attribs.href.replace(/.*?\/voddetail\/(.*).html/g, '$1'),
|
||||
vod_name: it.attribs.title,
|
||||
vod_pic: it.attribs['data-original'],
|
||||
vod_remarks: remarks || '',
|
||||
};
|
||||
});
|
||||
const hasMore = $('ul.myui-page > li > a:contains(下一页)').length > 0;
|
||||
const pgCount = hasMore ? parseInt(pg) + 1 : parseInt(pg);
|
||||
return JSON.stringify({
|
||||
page: parseInt(pg),
|
||||
pagecount: pgCount,
|
||||
limit: 24,
|
||||
total: 24 * pgCount,
|
||||
list: videos,
|
||||
});
|
||||
}
|
||||
|
||||
async function detail(id) {
|
||||
const html = await request(url + '/voddetail/' + id + '.html');
|
||||
const $ = load(html);
|
||||
let vod = {
|
||||
vod_id: id,
|
||||
vod_name: $('h1:first').text().trim(),
|
||||
vod_type: $('.myui-content__detail p:first a').text(),
|
||||
vod_actor: $('.myui-content__detail p:nth-child(5)').text().replace('主演:',''),
|
||||
vod_director: $('.myui-content__detail p:nth-child(6)').text().replace('导演:',''),
|
||||
vod_pic: $('div.myui-content__thumb img:first').attr('data-original'),
|
||||
vod_remarks :$('#rating:first span').text().replace(/\s{2,}/g, ' '),
|
||||
vod_content: $('span.data').text().trim(),
|
||||
};
|
||||
const playlist = _.map($('ul.sort-list > li > a'), (it) => {
|
||||
return it.children[0].data + '$' + it.attribs.href.replace(/\/vodplay\/(.*).html/g, '$1');
|
||||
});
|
||||
vod.vod_play_from = key;
|
||||
vod.vod_play_url = playlist.join('#');
|
||||
return JSON.stringify({
|
||||
list: [vod],
|
||||
});
|
||||
}
|
||||
|
||||
async function play(flag, id, flags) {
|
||||
const link = url + '/vodplay/' + id + '.html';
|
||||
const html = await request(link);
|
||||
const $ = load(html);
|
||||
const js = JSON.parse($('script:contains(player_)').html().replace('var player_data=',''));
|
||||
const playUrl = js.url.replace('index.m3u8','hls\/index.m3u8');
|
||||
return JSON.stringify({
|
||||
parse: 0,
|
||||
url: playUrl,
|
||||
});
|
||||
}
|
||||
|
||||
async function search(wd, quick) {
|
||||
let data = JSON.parse(await request(url + '/index.php/ajax/suggest?mid=1&wd=' + wd)).list;
|
||||
let videos = [];
|
||||
for (const vod of data) {
|
||||
videos.push({
|
||||
vod_id: vod.id,
|
||||
vod_name: vod.name,
|
||||
vod_pic: vod.pic,
|
||||
vod_remarks: '',
|
||||
});
|
||||
}
|
||||
return JSON.stringify({
|
||||
list: videos,
|
||||
});
|
||||
}
|
||||
|
||||
export function __jsEvalReturn() {
|
||||
return {
|
||||
init: init,
|
||||
home: home,
|
||||
homeVod: homeVod,
|
||||
category: category,
|
||||
detail: detail,
|
||||
play: play,
|
||||
search: search,
|
||||
};
|
||||
}
|
203
JN/EXT/OPENJS/ikanbot_open.js
Normal file
203
JN/EXT/OPENJS/ikanbot_open.js
Normal file
@ -0,0 +1,203 @@
|
||||
import { Crypto, load, _ } from './lib/cat.js';
|
||||
|
||||
let key = 'ikanbot';
|
||||
let url = 'https://www.ikanbot.com';
|
||||
let siteKey = '';
|
||||
let 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';
|
||||
|
||||
async function request(reqUrl, agentSp) {
|
||||
let res = await req(reqUrl, {
|
||||
method: 'get',
|
||||
headers: {
|
||||
'User-Agent': agentSp || UA,
|
||||
},
|
||||
});
|
||||
return res.content;
|
||||
}
|
||||
|
||||
// cfg = {skey: siteKey, ext: extend}
|
||||
async function init(cfg) {
|
||||
siteKey = cfg.skey;
|
||||
siteType = cfg.stype;
|
||||
}
|
||||
|
||||
function getClass($) {
|
||||
const nav = $('ul.nav-pills:eq(1) > li > a');
|
||||
let tags = {
|
||||
key: 'tag',
|
||||
name: '标签',
|
||||
value: _.map(nav, (n) => {
|
||||
return { n: n.children[0].data, v: n.attribs.href };
|
||||
}),
|
||||
};
|
||||
tags['init'] = tags.value[0].v;
|
||||
const title = $('title:first').text().split('-')[0].substring(2);
|
||||
return { cls: { type_id: tags.value[0].v, type_name: title }, tags: [tags] };
|
||||
}
|
||||
|
||||
async function home(filter) {
|
||||
let classes = [];
|
||||
let filterObj = {};
|
||||
for (const cate of ['/hot/index-movie-热门.html', '/hot/index-tv-热门.html']) {
|
||||
const html = await request(url + cate);
|
||||
const $ = load(html);
|
||||
const { cls, tags } = getClass($);
|
||||
classes.push(cls);
|
||||
filterObj[cls.type_id] = tags;
|
||||
}
|
||||
return JSON.stringify({
|
||||
class: classes,
|
||||
filters: filterObj,
|
||||
});
|
||||
}
|
||||
|
||||
async function homeVod() {
|
||||
return '{}';
|
||||
}
|
||||
|
||||
async function category(tid, pg, filter, extend) {
|
||||
if (pg <= 0) pg = 1;
|
||||
const link = url + (extend.tag || tid).replace('.html', pg > 1 ? `-p-${pg}.html` : '.html');
|
||||
const html = await request(link);
|
||||
const $ = load(html);
|
||||
const items = $('div.v-list a.item');
|
||||
var jsBase = await js2Proxy(true, siteType, siteKey, 'img/', {});
|
||||
let videos = _.map(items, (item) => {
|
||||
const img = $(item).find('img:first')[0];
|
||||
return {
|
||||
vod_id: item.attribs.href,
|
||||
vod_name: img.attribs.alt,
|
||||
vod_pic: jsBase + base64Encode(img.attribs['data-src']),
|
||||
vod_remarks: '',
|
||||
};
|
||||
});
|
||||
const hasMore = $('div.page-more > a:contains(下一页)').length > 0;
|
||||
const pgCount = hasMore ? parseInt(pg) + 1 : parseInt(pg);
|
||||
return JSON.stringify({
|
||||
page: parseInt(pg),
|
||||
pagecount: pgCount,
|
||||
limit: 24,
|
||||
total: 24 * pgCount,
|
||||
list: videos,
|
||||
});
|
||||
}
|
||||
|
||||
async function detail(id) {
|
||||
const html = await request(url + id);
|
||||
const $ = load(html);
|
||||
var jsBase = await js2Proxy(true, siteType, siteKey, 'img/', {});
|
||||
const detail = $('div.detail > .meta');
|
||||
let vod = {
|
||||
vod_id: id,
|
||||
vod_pic: jsBase + base64Encode($('div.item-root > img')[0].attribs['data-src']),
|
||||
vod_remarks: '',
|
||||
};
|
||||
for (const info of detail) {
|
||||
if ($(info).hasClass('title')) {
|
||||
vod.vod_name = info.children[0].data;
|
||||
} else if ($(info).hasClass('year')) {
|
||||
vod.vod_area = info.children[0].data;
|
||||
} else if ($(info).hasClass('country')) {
|
||||
vod.vod_area = info.children[0].data;
|
||||
} else if ($(info).hasClass('celebrity')) {
|
||||
vod.vod_actor = info.children[0].data;
|
||||
}
|
||||
}
|
||||
|
||||
const res = await req(url + '/api/getResN?videoId=' + id.substring(id.lastIndexOf('/') + 1) + '&mtype=2', {
|
||||
headers: {
|
||||
Referer: url,
|
||||
'User-Agent': UA,
|
||||
},
|
||||
});
|
||||
const list = JSON.parse(res.content).data.list;
|
||||
let playlist = {};
|
||||
for (const l of list) {
|
||||
const flagData = JSON.parse(l.resData);
|
||||
for (const f of flagData) {
|
||||
const from = f.flag;
|
||||
const urls = f.url;
|
||||
if (!from || !urls) continue;
|
||||
if (playlist[from]) continue;
|
||||
playlist[from] = urls;
|
||||
}
|
||||
}
|
||||
vod.vod_play_from = _.keys(playlist).join('$$$');
|
||||
vod.vod_play_url = _.values(playlist).join('$$$');
|
||||
return JSON.stringify({
|
||||
list: [vod],
|
||||
});
|
||||
}
|
||||
|
||||
function base64Encode(text) {
|
||||
return Crypto.enc.Base64.stringify(Crypto.enc.Utf8.parse(text));
|
||||
}
|
||||
|
||||
function base64Decode(text) {
|
||||
return Crypto.enc.Utf8.stringify(Crypto.enc.Base64.parse(text));
|
||||
}
|
||||
|
||||
async function proxy(segments, headers) {
|
||||
let what = segments[0];
|
||||
let url = base64Decode(segments[1]);
|
||||
if (what == 'img') {
|
||||
var resp = await req(url, {
|
||||
buffer: 2,
|
||||
headers: {
|
||||
Referer: url,
|
||||
'User-Agent': UA,
|
||||
},
|
||||
});
|
||||
return JSON.stringify({
|
||||
code: resp.code,
|
||||
buffer: 2,
|
||||
content: resp.content,
|
||||
headers: resp.headers,
|
||||
});
|
||||
}
|
||||
return JSON.stringify({
|
||||
code: 500,
|
||||
content: '',
|
||||
});
|
||||
}
|
||||
|
||||
async function play(flag, id, flags) {
|
||||
return JSON.stringify({
|
||||
parse: 0,
|
||||
url: id,
|
||||
});
|
||||
}
|
||||
|
||||
async function search(wd, quick) {
|
||||
const html = await request(url + '/search?q=' + wd);
|
||||
const $ = load(html);
|
||||
const items = $('div.media > div.media-left > a');
|
||||
var jsBase = await js2Proxy(true, siteType, siteKey, 'img/', {});
|
||||
let videos = _.map(items, (item) => {
|
||||
const img = $(item).find('img:first')[0];
|
||||
return {
|
||||
vod_id: item.attribs.href,
|
||||
vod_name: img.attribs.alt,
|
||||
vod_pic: jsBase + base64Encode(img.attribs['data-src']),
|
||||
vod_remarks: '',
|
||||
};
|
||||
});
|
||||
return JSON.stringify({
|
||||
list: videos,
|
||||
});
|
||||
}
|
||||
|
||||
export function __jsEvalReturn() {
|
||||
return {
|
||||
init: init,
|
||||
home: home,
|
||||
homeVod: homeVod,
|
||||
category: category,
|
||||
detail: detail,
|
||||
play: play,
|
||||
proxy: proxy,
|
||||
search: search,
|
||||
};
|
||||
}
|
364
JN/EXT/OPENJS/kkys_open.js
Normal file
364
JN/EXT/OPENJS/kkys_open.js
Normal file
@ -0,0 +1,364 @@
|
||||
import { Crypto, dayjs, jinja2, _ } from './lib/cat.js';
|
||||
|
||||
let key = 'kkys';
|
||||
let url = 'https://api1.baibaipei.com:8899';
|
||||
let device = {};
|
||||
let siteKey = '';
|
||||
let siteType = 0;
|
||||
|
||||
async function request(reqUrl, postData, agentSp, get) {
|
||||
let ts = dayjs().valueOf().toString();
|
||||
let rand = randStr(32);
|
||||
let sign = Crypto.MD5('abcdexxxdd2daklmn25129_' + ts + '_' + rand)
|
||||
.toString()
|
||||
.toLowerCase();
|
||||
let headers = {
|
||||
'user-agent': agentSp || device.ua,
|
||||
};
|
||||
if (reqUrl.includes('baibaipei')) {
|
||||
headers['device-id'] = device.id;
|
||||
headers['push-token'] = '';
|
||||
headers['sign'] = sign;
|
||||
headers['time'] = ts;
|
||||
headers['md5'] = rand;
|
||||
headers['version'] = '2.1.0';
|
||||
headers['system-model'] = device.model;
|
||||
headers['system-brand'] = device.brand;
|
||||
headers['system-version'] = device.release;
|
||||
}
|
||||
let res = await req(reqUrl, {
|
||||
method: get ? 'get' : 'post',
|
||||
headers: headers,
|
||||
data: postData || {},
|
||||
postType: get ? '' : 'form',
|
||||
});
|
||||
|
||||
let content = res.content;
|
||||
// console.log(content);
|
||||
return content;
|
||||
}
|
||||
|
||||
async function init(cfg) {
|
||||
siteKey = cfg.skey;
|
||||
siteType = cfg.stype;
|
||||
var deviceKey = 'device';
|
||||
var deviceInfo = await local.get(key, deviceKey);
|
||||
if (deviceInfo.length > 0) {
|
||||
try {
|
||||
device = JSON.parse(deviceInfo);
|
||||
} catch (error) {}
|
||||
}
|
||||
if (_.isEmpty(device)) {
|
||||
device = randDevice();
|
||||
device.id = randStr(33).toLowerCase();
|
||||
device.ua = 'okhttp/4.1.0';
|
||||
await local.set(key, deviceKey, JSON.stringify(device));
|
||||
}
|
||||
}
|
||||
|
||||
async function home(filter) {
|
||||
// await req('https://www.facebook.com', {});
|
||||
let data = JSON.parse(await request(url + '/api.php/Index/getTopVideoCategory')).data;
|
||||
let classes = [];
|
||||
let filterObj = {};
|
||||
for (const type of data) {
|
||||
let typeName = type.nav_name;
|
||||
if (typeName == '推荐') continue;
|
||||
let typeId = type.nav_type_id.toString();
|
||||
classes.push({
|
||||
type_id: typeId,
|
||||
type_name: typeName,
|
||||
});
|
||||
if (!filter) continue;
|
||||
try {
|
||||
let filterAll = [];
|
||||
let filterData = JSON.parse(await request(url + '/api.php/Video/getFilterType', { type: typeId })).data;
|
||||
for (let key of Object.keys(filterData)) {
|
||||
let itemValues = filterData[key];
|
||||
if (key === 'plot') key = 'class';
|
||||
let typeExtendName = '';
|
||||
switch (key) {
|
||||
case 'class':
|
||||
typeExtendName = '类型';
|
||||
break;
|
||||
case 'area':
|
||||
typeExtendName = '地区';
|
||||
break;
|
||||
case 'lang':
|
||||
typeExtendName = '语言';
|
||||
break;
|
||||
case 'year':
|
||||
typeExtendName = '年代';
|
||||
break;
|
||||
case 'sort':
|
||||
typeExtendName = '排序';
|
||||
break;
|
||||
}
|
||||
if (typeExtendName.length === 0) continue;
|
||||
let newTypeExtend = {
|
||||
key: key,
|
||||
name: typeExtendName,
|
||||
};
|
||||
let newTypeExtendKV = [];
|
||||
for (let j = 0; j < itemValues.length; j++) {
|
||||
const name = itemValues[j];
|
||||
let value = key === 'sort' ? j + '' : name === '全部' ? '0' : name;
|
||||
newTypeExtendKV.push({ n: name, v: value });
|
||||
}
|
||||
newTypeExtend['init'] = key === 'sort' ? '1' : newTypeExtendKV[0]['v'];
|
||||
newTypeExtend.value = newTypeExtendKV;
|
||||
filterAll.push(newTypeExtend);
|
||||
}
|
||||
if (!_.isEmpty(filterAll)) {
|
||||
filterObj[typeId] = filterAll;
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
// console.log(await homeVod());
|
||||
// console.log(classes);
|
||||
// console.log(filterObj);
|
||||
return JSON.stringify({
|
||||
class: classes,
|
||||
filters: filterObj,
|
||||
});
|
||||
}
|
||||
|
||||
async function homeVod() {
|
||||
let jsonArray = JSON.parse(await request(url + '/api.php/Index/getHomePage', { type: 1, p: 1 })).data.video;
|
||||
let videos = [];
|
||||
for (const item of jsonArray) {
|
||||
if (item.title.styleType !== 0) continue;
|
||||
for (const vObj of item.list) {
|
||||
videos.push({
|
||||
vod_id: vObj.vod_id,
|
||||
vod_name: vObj.vod_name,
|
||||
vod_pic: vObj.vod_pic,
|
||||
vod_remarks: vObj.vod_remarks || vObj.vod_score || '',
|
||||
});
|
||||
}
|
||||
}
|
||||
return JSON.stringify({
|
||||
list: videos,
|
||||
});
|
||||
}
|
||||
|
||||
async function category(tid, pg, filter, extend) {
|
||||
if (pg == 0) pg = 1;
|
||||
let reqUrl = url + '/api.php/Video/getFilterVideoList';
|
||||
var formData = JSON.parse(
|
||||
jinja2(
|
||||
`{
|
||||
"type": "{{tid}}",
|
||||
"p": "{{pg}}",
|
||||
"area": "{{ext.area|default(0)}}",
|
||||
"year": "{{ext.year|default(0)}}",
|
||||
"sort": "{{ext.sort|default(0)}}",
|
||||
"class": "{{ext.class|default(0)}}"
|
||||
}`,
|
||||
{ ext: extend, tid: tid, pg: pg }
|
||||
)
|
||||
);
|
||||
console.log(formData);
|
||||
let data = JSON.parse(await request(reqUrl, formData)).data;
|
||||
let videos = [];
|
||||
for (const vod of data.data) {
|
||||
videos.push({
|
||||
vod_id: vod.vod_id,
|
||||
vod_name: vod.vod_name,
|
||||
vod_pic: vod.vod_pic,
|
||||
vod_remarks: vod.vod_remarks || vod.vod_score || '',
|
||||
});
|
||||
}
|
||||
return JSON.stringify({
|
||||
page: parseInt(data.current_page),
|
||||
pagecount: parseInt(data.last_page),
|
||||
limit: parseInt(data.per_page),
|
||||
total: parseInt(data.total),
|
||||
list: videos,
|
||||
});
|
||||
}
|
||||
|
||||
async function detail(id) {
|
||||
let data = JSON.parse(await request(url + '/api.php/Video/getVideoInfo', { video_id: id })).data.video;
|
||||
let vod = {
|
||||
vod_id: data.vod_id,
|
||||
vod_name: data.vod_name,
|
||||
vod_pic: data.vod_pic,
|
||||
type_name: data.vod_class,
|
||||
vod_year: data.vod_year,
|
||||
vod_area: data.vod_area,
|
||||
vod_remarks: data.vod_remarks || '',
|
||||
vod_actor: data.vod_actor,
|
||||
vod_director: data.vod_director,
|
||||
vod_content: data.vod_content.trim(),
|
||||
};
|
||||
let playlist = {};
|
||||
for (const item of data.vod_play) {
|
||||
let from = item.playerForm;
|
||||
if (from === 'jp') continue;
|
||||
if (from === 'xg') continue;
|
||||
let urls = [];
|
||||
for (const u of item.url) {
|
||||
urls.push(formatPlayUrl(vod.vod_name, u.title) + '$' + u.play_url);
|
||||
}
|
||||
if (!playlist.hasOwnProperty(from) && urls.length > 0) {
|
||||
playlist[from] = urls;
|
||||
}
|
||||
}
|
||||
parse = data.parse || [];
|
||||
vod.vod_play_from = _.keys(playlist).join('$$$');
|
||||
let urls = _.values(playlist);
|
||||
let vod_play_url = [];
|
||||
for (const urlist of urls) {
|
||||
vod_play_url.push(urlist.join('#'));
|
||||
}
|
||||
vod.vod_play_url = vod_play_url.join('$$$');
|
||||
return JSON.stringify({
|
||||
list: [vod],
|
||||
});
|
||||
}
|
||||
|
||||
var parse = [];
|
||||
|
||||
async function play(flag, id, flags) {
|
||||
try {
|
||||
if (id.indexOf('youku') >= 0 || id.indexOf('iqiyi') >= 0 || id.indexOf('v.qq.com') >= 0 || id.indexOf('pptv') >= 0 || id.indexOf('le.com') >= 0 || id.indexOf('1905.com') >= 0 || id.indexOf('mgtv') >= 0) {
|
||||
if (parse.length > 0) {
|
||||
for (let index = 0; index < parse.length; index++) {
|
||||
try {
|
||||
const p = parse[index];
|
||||
let res = await req(p + id, {
|
||||
headers: { 'user-agent': 'okhttp/4.1.0' },
|
||||
});
|
||||
var result = jsonParse(id, JSON.parse(res.content));
|
||||
if (result.url) {
|
||||
result.parse = 0;
|
||||
return JSON.stringify(result);
|
||||
}
|
||||
} catch (error) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (id.indexOf('jqq-') >= 0) {
|
||||
var jqqHeader = await request(url + '/jqqheader.json', null, null, true);
|
||||
var jqqHeaders = JSON.parse(jqqHeader);
|
||||
var ids = id.split('-');
|
||||
var jxJqq = await req('https://api.juquanquanapp.com/app/drama/detail?dramaId=' + ids[1] + '&episodeSid=' + ids[2] + '&quality=LD', { headers: jqqHeaders });
|
||||
var jqqInfo = JSON.parse(jxJqq.content);
|
||||
if (jqqInfo.data.playInfo.url) {
|
||||
return JSON.stringify({
|
||||
parse: 0,
|
||||
playUrl: '',
|
||||
url: jqqInfo.data.playInfo.url,
|
||||
});
|
||||
}
|
||||
}
|
||||
let res = await request(url + '/video.php', { url: id });
|
||||
var result = jsonParse(id, JSON.parse(res).data);
|
||||
if (result.url) {
|
||||
result.parse = 0;
|
||||
return JSON.stringify(result);
|
||||
}
|
||||
return JSON.stringify({
|
||||
parse: 0,
|
||||
playUrl: '',
|
||||
url: id,
|
||||
});
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
return JSON.stringify({
|
||||
parse: 0,
|
||||
url: id,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async function search(wd, quick) {
|
||||
let data = JSON.parse(await request(url + '/api.php/Search/getSearch', { key: wd, type_id: 0, p: 1 })).data;
|
||||
let videos = [];
|
||||
for (const vod of data.data) {
|
||||
videos.push({
|
||||
vod_id: vod.vod_id,
|
||||
vod_name: vod.vod_name,
|
||||
vod_pic: vod.vod_pic,
|
||||
vod_remarks: vod.vod_remarks || vod.vod_score || '',
|
||||
});
|
||||
}
|
||||
return JSON.stringify({
|
||||
list: videos,
|
||||
});
|
||||
}
|
||||
|
||||
const charStr = 'abacdefghjklmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ0123456789';
|
||||
function randStr(len, withNum) {
|
||||
var _str = '';
|
||||
let containsNum = withNum === undefined ? true : withNum;
|
||||
for (var i = 0; i < len; i++) {
|
||||
let idx = _.random(0, containsNum ? charStr.length - 1 : charStr.length - 11);
|
||||
_str += charStr[idx];
|
||||
}
|
||||
return _str;
|
||||
}
|
||||
|
||||
function randDevice() {
|
||||
return {
|
||||
brand: 'Huawei',
|
||||
model: 'HUAWEI Mate 20',
|
||||
release: '10',
|
||||
buildId: randStr(3, false).toUpperCase() + _.random(11, 99) + randStr(1, false).toUpperCase(),
|
||||
};
|
||||
}
|
||||
|
||||
function formatPlayUrl(src, name) {
|
||||
return name
|
||||
.trim()
|
||||
.replaceAll(src, '')
|
||||
.replace(/<|>|《|》/g, '')
|
||||
.replace(/\$|#/g, ' ')
|
||||
.trim();
|
||||
}
|
||||
|
||||
function jsonParse(input, json) {
|
||||
try {
|
||||
let url = json.url ?? '';
|
||||
if (url.startsWith('//')) {
|
||||
url = 'https:' + url;
|
||||
}
|
||||
if (!url.startsWith('http')) {
|
||||
return {};
|
||||
}
|
||||
let headers = json['headers'] || {};
|
||||
let ua = (json['user-agent'] || '').trim();
|
||||
if (ua.length > 0) {
|
||||
headers['User-Agent'] = ua;
|
||||
}
|
||||
let referer = (json['referer'] || '').trim();
|
||||
if (referer.length > 0) {
|
||||
headers['Referer'] = referer;
|
||||
}
|
||||
_.keys(headers).forEach((hk) => {
|
||||
if (!headers[hk]) delete headers[hk];
|
||||
});
|
||||
return {
|
||||
header: headers,
|
||||
url: url,
|
||||
};
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
export function __jsEvalReturn() {
|
||||
return {
|
||||
init: init,
|
||||
home: home,
|
||||
homeVod: homeVod,
|
||||
category: category,
|
||||
detail: detail,
|
||||
play: play,
|
||||
search: search,
|
||||
};
|
||||
}
|
341
JN/EXT/OPENJS/kunyu77_open.js
Normal file
341
JN/EXT/OPENJS/kunyu77_open.js
Normal file
@ -0,0 +1,341 @@
|
||||
import { Crypto, dayjs, jinja2, Uri, _ } from './lib/cat.js';
|
||||
|
||||
let key = 'kunyu77';
|
||||
let url = 'http://api.tyun77.cn';
|
||||
let device = {};
|
||||
let timeOffset = 0;
|
||||
let siteKey = '';
|
||||
let siteType = 0;
|
||||
|
||||
async function request(reqUrl, agentSp) {
|
||||
let sj = dayjs().unix() - timeOffset;
|
||||
let uri = new Uri(reqUrl);
|
||||
uri.addQueryParam('pcode', '010110005');
|
||||
uri.addQueryParam('version', '2.1.6');
|
||||
uri.addQueryParam('devid', device.id);
|
||||
uri.addQueryParam('package', 'com.sevenVideo.app.android');
|
||||
uri.addQueryParam('sys', 'android');
|
||||
uri.addQueryParam('sysver', device.release);
|
||||
uri.addQueryParam('brand', device.brand);
|
||||
uri.addQueryParam('model', device.model.replaceAll(' ', '_'));
|
||||
uri.addQueryParam('sj', sj);
|
||||
let keys = [];
|
||||
for (var i = 0; i < uri.queryPairs.length; i++) {
|
||||
keys.push(uri.queryPairs[i][0]);
|
||||
}
|
||||
keys = _.sortBy(keys, function (name) {
|
||||
return name;
|
||||
});
|
||||
let tkSrc = uri.path();
|
||||
for (let k of keys) {
|
||||
let v = uri.getQueryParamValue(k);
|
||||
v = encodeURIComponent(v);
|
||||
tkSrc += v;
|
||||
}
|
||||
tkSrc += sj;
|
||||
tkSrc += 'XSpeUFjJ';
|
||||
console.log(tkSrc);
|
||||
let tk = Crypto.MD5(tkSrc).toString().toLowerCase();
|
||||
console.log(tk);
|
||||
let header = {
|
||||
'user-agent': agentSp || 'okhttp/3.12.0',
|
||||
t: sj,
|
||||
TK: tk,
|
||||
};
|
||||
let res = await req(uri.toString(), {
|
||||
headers: header,
|
||||
});
|
||||
|
||||
let serverTime = res.headers.date; // dart all response header key is lowercase
|
||||
let content = res.content;
|
||||
let serverTimeS = dayjs(serverTime).unix();
|
||||
timeOffset = dayjs().unix() - serverTimeS;
|
||||
// console.log(content);
|
||||
return content;
|
||||
}
|
||||
|
||||
async function init(cfg) {
|
||||
siteKey = cfg.skey;
|
||||
siteType = cfg.stype;
|
||||
var deviceKey = 'device';
|
||||
var deviceInfo = await local.get(key, deviceKey);
|
||||
if (deviceInfo.length > 0) {
|
||||
try {
|
||||
device = JSON.parse(deviceInfo);
|
||||
} catch (error) {}
|
||||
}
|
||||
if (_.isEmpty(device)) {
|
||||
device = randDevice();
|
||||
device.id = randStr(32).toLowerCase();
|
||||
device.ua = 'Dalvik/2.1.0 (Linux; U; Android ' + device.release + '; ' + device.model + ' Build/' + device.buildId + ')';
|
||||
await local.set(key, deviceKey, JSON.stringify(device));
|
||||
}
|
||||
await request(url + '/api.php/provide/getDomain');
|
||||
await request(url + '/api.php/provide/config');
|
||||
await request(url + '/api.php/provide/checkUpgrade');
|
||||
await request(url + '/api.php/provide/channel');
|
||||
}
|
||||
|
||||
async function home(filter) {
|
||||
let data = JSON.parse(await request(url + '/api.php/provide/filter')).data;
|
||||
let classes = [];
|
||||
let filterObj = {};
|
||||
let filterAll = [];
|
||||
for (const key in data) {
|
||||
classes.push({
|
||||
type_id: key,
|
||||
type_name: data[key][0].cat,
|
||||
});
|
||||
if (!filter) continue;
|
||||
try {
|
||||
let typeId = key.toString();
|
||||
if (_.isEmpty(filterAll)) {
|
||||
let filterData = JSON.parse(await request(url + '/api.php/provide/searchFilter?type_id=0&pagenum=1&pagesize=1')).data.conditions;
|
||||
// console.log(filterData);
|
||||
// 年份
|
||||
let year = {
|
||||
key: 'year',
|
||||
name: '年份',
|
||||
init: '',
|
||||
};
|
||||
let yearValues = [];
|
||||
yearValues.push({ n: '全部', v: '' });
|
||||
filterData.y.forEach((e) => {
|
||||
yearValues.push({ n: e.name, v: e.value });
|
||||
});
|
||||
year['value'] = yearValues;
|
||||
// 地区
|
||||
let area = {
|
||||
key: 'area',
|
||||
name: '地区',
|
||||
init: '',
|
||||
};
|
||||
let areaValues = [];
|
||||
areaValues.push({ n: '全部', v: '' });
|
||||
filterData.a.forEach((e) => {
|
||||
areaValues.push({ n: e.name, v: e.value });
|
||||
});
|
||||
area['value'] = areaValues;
|
||||
// 类型
|
||||
let type = {
|
||||
key: 'category',
|
||||
name: '类型',
|
||||
init: '',
|
||||
};
|
||||
let typeValues = [];
|
||||
typeValues.push({ n: '全部', v: '' });
|
||||
filterData.scat.forEach((e) => {
|
||||
typeValues.push({ n: e.name, v: e.value });
|
||||
});
|
||||
type['value'] = typeValues;
|
||||
|
||||
filterAll.push(year, area, type);
|
||||
}
|
||||
if (!_.isEmpty(filterAll)) {
|
||||
filterObj[typeId] = filterAll;
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
// console.log(classes);
|
||||
// console.log(filterObj);
|
||||
return JSON.stringify({
|
||||
class: classes,
|
||||
filters: filterObj,
|
||||
});
|
||||
}
|
||||
|
||||
async function homeVod() {
|
||||
let data = JSON.parse(await request(url + '/api.php/provide/homeBlock?type_id=0')).data;
|
||||
let blocks = data.blocks;
|
||||
let videos = [];
|
||||
for (const block of blocks) {
|
||||
let name = block.block_name;
|
||||
if (name.indexOf('热播') >= 0) continue;
|
||||
let contents = block.contents;
|
||||
for (const content of contents) {
|
||||
videos.push({
|
||||
vod_id: content.id,
|
||||
vod_name: content.title,
|
||||
vod_pic: content.videoCover,
|
||||
vod_remarks: content.msg,
|
||||
});
|
||||
}
|
||||
}
|
||||
return JSON.stringify({
|
||||
list: videos,
|
||||
});
|
||||
}
|
||||
|
||||
async function category(tid, pg, filter, extend) {
|
||||
let reqUrl = url + '/api.php/provide/searchFilter?type_id=' + tid + '&pagenum=' + pg + '&pagesize=24&';
|
||||
reqUrl += jinja2('year={{ext.year}}&category={{ext.category}}&area={{ext.area}}', { ext: extend });
|
||||
let data = JSON.parse(await request(reqUrl)).data;
|
||||
let videos = [];
|
||||
for (const vod of data.result) {
|
||||
videos.push({
|
||||
vod_id: vod.id,
|
||||
vod_name: vod.title,
|
||||
vod_pic: vod.videoCover,
|
||||
vod_remarks: vod.msg,
|
||||
});
|
||||
}
|
||||
return JSON.stringify({
|
||||
page: parseInt(data.page),
|
||||
pagecount: data.pagesize,
|
||||
limit: 24,
|
||||
total: data.total,
|
||||
list: videos,
|
||||
});
|
||||
}
|
||||
|
||||
async function detail(id) {
|
||||
let data = JSON.parse(await request(url + '/api.php/provide/videoDetail?ids=' + id)).data;
|
||||
console.log(data);
|
||||
let vod = {
|
||||
vod_id: data.id,
|
||||
vod_name: data.videoName,
|
||||
vod_pic: data.videoCover,
|
||||
type_name: data.subCategory,
|
||||
vod_year: data.year,
|
||||
vod_area: data.area,
|
||||
vod_remarks: data.msg,
|
||||
vod_actor: data.actor,
|
||||
vod_director: data.director,
|
||||
vod_content: data.brief.trim(),
|
||||
};
|
||||
let episodes = JSON.parse(await request(url + '/api.php/provide/videoPlaylist?ids=' + id)).data.episodes;
|
||||
let playlist = {};
|
||||
for (const episode of episodes) {
|
||||
let playurls = episode.playurls;
|
||||
for (const playurl of playurls) {
|
||||
let from = playurl.playfrom;
|
||||
let t = formatPlayUrl(vod.vod_name, playurl.title);
|
||||
if (t.length == 0) t = playurl.title.trim();
|
||||
if (!playlist.hasOwnProperty(from)) {
|
||||
playlist[from] = [];
|
||||
}
|
||||
playlist[from].push(t + '$' + playurl.playurl);
|
||||
}
|
||||
}
|
||||
vod.vod_play_from = _.keys(playlist).join('$$$');
|
||||
let urls = _.values(playlist);
|
||||
let vod_play_url = [];
|
||||
for (const urlist of urls) {
|
||||
vod_play_url.push(urlist.join('#'));
|
||||
}
|
||||
vod.vod_play_url = vod_play_url.join('$$$');
|
||||
return JSON.stringify({
|
||||
list: [vod],
|
||||
});
|
||||
}
|
||||
|
||||
async function play(flag, id, flags) {
|
||||
try {
|
||||
let data = JSON.parse(await request(url + '/api.php/provide/parserUrl?url=' + id + '&retryNum=0')).data;
|
||||
let playHeader = data.playHeader;
|
||||
let jxUrl = data.url;
|
||||
let res = await req(jxUrl, {
|
||||
headers: {
|
||||
'user-agent': 'okhttp/3.12.0',
|
||||
},
|
||||
});
|
||||
let result = jsonParse(id, JSON.parse(res.content));
|
||||
result['parse'] = 0;
|
||||
if (playHeader) {
|
||||
result.header = _.merge(result.header, playHeader);
|
||||
}
|
||||
return JSON.stringify(result);
|
||||
} catch (e) {
|
||||
return JSON.stringify({
|
||||
parse: 0,
|
||||
url: id,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async function search(wd, quick) {
|
||||
let data = JSON.parse(await request(url + '/api.php/provide/searchVideo?searchName=' + wd + '&pg=1', 'okhttp/3.12.0')).data;
|
||||
let videos = [];
|
||||
for (const vod of data) {
|
||||
videos.push({
|
||||
vod_id: vod.id,
|
||||
vod_name: vod.videoName,
|
||||
vod_pic: vod.videoCover,
|
||||
vod_remarks: vod.msg,
|
||||
});
|
||||
}
|
||||
return JSON.stringify({
|
||||
list: videos,
|
||||
});
|
||||
}
|
||||
|
||||
const charStr = 'abacdefghjklmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ0123456789';
|
||||
function randStr(len, withNum) {
|
||||
var _str = '';
|
||||
let containsNum = withNum === undefined ? true : withNum;
|
||||
for (var i = 0; i < len; i++) {
|
||||
let idx = _.random(0, containsNum ? charStr.length - 1 : charStr.length - 11);
|
||||
_str += charStr[idx];
|
||||
}
|
||||
return _str;
|
||||
}
|
||||
|
||||
function randDevice() {
|
||||
return {
|
||||
brand: 'Huawei',
|
||||
model: 'HUAWEI Mate 20',
|
||||
release: '10',
|
||||
buildId: randStr(3, false).toUpperCase() + _.random(11, 99) + randStr(1, false).toUpperCase(),
|
||||
};
|
||||
}
|
||||
|
||||
function formatPlayUrl(src, name) {
|
||||
return name
|
||||
.trim()
|
||||
.replaceAll(src, '')
|
||||
.replace(/<|>|《|》/g, '')
|
||||
.replace(/\$|#/g, ' ')
|
||||
.trim();
|
||||
}
|
||||
|
||||
function jsonParse(input, json) {
|
||||
try {
|
||||
let url = json.url ?? '';
|
||||
if (url.startsWith('//')) {
|
||||
url = 'https:' + url;
|
||||
}
|
||||
if (!url.startsWith('http')) {
|
||||
return {};
|
||||
}
|
||||
let headers = json['headers'] || {};
|
||||
let ua = (json['user-agent'] || '').trim();
|
||||
if (ua.length > 0) {
|
||||
headers['User-Agent'] = ua;
|
||||
}
|
||||
let referer = (json['referer'] || '').trim();
|
||||
if (referer.length > 0) {
|
||||
headers['Referer'] = referer;
|
||||
}
|
||||
return {
|
||||
header: headers,
|
||||
url: url,
|
||||
};
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
export function __jsEvalReturn() {
|
||||
return {
|
||||
init: init,
|
||||
home: home,
|
||||
homeVod: homeVod,
|
||||
category: category,
|
||||
detail: detail,
|
||||
play: play,
|
||||
search: search,
|
||||
};
|
||||
}
|
1
JN/EXT/OPENJS/nivod_open.js
Normal file
1
JN/EXT/OPENJS/nivod_open.js
Normal file
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user