mirror of
https://github.com/qist/tvbox.git
synced 2025-01-24 03:04:56 +08:00
测试 猫影视资源
This commit is contained in:
parent
cf25121f7a
commit
16a0a9520e
193
cat.json
Normal file
193
cat.json
Normal file
@ -0,0 +1,193 @@
|
||||
{
|
||||
"video": {
|
||||
"sites": [
|
||||
{
|
||||
"key": "drpy_js_boosj_open",
|
||||
"name": "童趣┃猫",
|
||||
"type": 3,
|
||||
"api": "assets://js/boosj_open.js"
|
||||
},
|
||||
{
|
||||
"key": "drpy_js_tuxiaobei_open",
|
||||
"name": "兔小贝┃猫",
|
||||
"type": 3,
|
||||
"api": "assets://js/tuxiaobei_open.js"
|
||||
},
|
||||
{
|
||||
"key": "drpy_js_ubestkid_open",
|
||||
"name": "贝乐虎┃猫",
|
||||
"type": 3,
|
||||
"api": "assets://js/ubestkid_open.js"
|
||||
},
|
||||
{
|
||||
"key": "drpy_js_dj0898_open",
|
||||
"name": "世纪DJ┃猫",
|
||||
"type": 3,
|
||||
"api": "assets://js/dj0898_open.js"
|
||||
},
|
||||
{
|
||||
"key": "drpy_js_zxzj_open",
|
||||
"name": "在线之家┃猫",
|
||||
"type": 3,
|
||||
"api": "assets://js/zxzj_open.js"
|
||||
},
|
||||
{
|
||||
"key": "drpy_js_cntv_open",
|
||||
"name": "视聚场┃猫",
|
||||
"type": 3,
|
||||
"api": "assets://js/cntv_open.js"
|
||||
},
|
||||
{
|
||||
"key": "drpy_js_bili_open",
|
||||
"name": "哔哩合集┃猫",
|
||||
"type": 3,
|
||||
"api": "assets://js/bili_open.js"
|
||||
},
|
||||
{
|
||||
"key": "wogg",
|
||||
"name": "Cat_open_js_玩偶|猫影视app",
|
||||
"type": 3,
|
||||
"api": "assets://js/wogg_open.js",
|
||||
"ext": "8069d2ca50c749ed932e171fb2a41b95"
|
||||
},
|
||||
{
|
||||
"key": "kunyu77",
|
||||
"name": "Cat_open_js_鲲鱼|猫影视app",
|
||||
"type": 3,
|
||||
"api": "assets://js/kunyu77_open.js"
|
||||
},
|
||||
{
|
||||
"key": "czzy",
|
||||
"name": "Cat_open_js_厂长|猫影视app",
|
||||
"type": 3,
|
||||
"api": "assets://js/czzy_open.js"
|
||||
},
|
||||
{
|
||||
"key": "libvio",
|
||||
"name": "Cat_open_js_黎波|猫影视app",
|
||||
"type": 3,
|
||||
"api": "assets://js/libvio_open.js"
|
||||
},
|
||||
{
|
||||
"key": "kkys",
|
||||
"name": "Cat_open_js_快看|猫影视app",
|
||||
"type": 3,
|
||||
"api": "assets://js/kkys_open.js"
|
||||
},
|
||||
{
|
||||
"key": "ikanbot",
|
||||
"name": "Cat_open_js_爱看|猫影视app",
|
||||
"type": 3,
|
||||
"api": "assets://js/ikanbot_open.js"
|
||||
},
|
||||
{
|
||||
"key": "ngys",
|
||||
"name": "Cat_open_js_南瓜|猫影视app",
|
||||
"type": 3,
|
||||
"api": "assets://js/ng_open.js"
|
||||
},
|
||||
{
|
||||
"key": "duboku",
|
||||
"name": "Cat_open_js_独播库|猫影视app",
|
||||
"type": 3,
|
||||
"api": "assets://js/duboku_open.js"
|
||||
},
|
||||
{
|
||||
"key": "subaibai",
|
||||
"name": "Cat_open_js_素白白|猫影视app",
|
||||
"type": 3,
|
||||
"api": "assets://js/subaibai_open.js"
|
||||
},
|
||||
{
|
||||
"key": "sharenice",
|
||||
"name": "Cat_open_js_短视频|猫影视app",
|
||||
"type": 3,
|
||||
"api": "assets://js/sharenice_open.js"
|
||||
},
|
||||
{
|
||||
"key": "mybili",
|
||||
"name": "Cat_open_js_哔哩|猫影视app",
|
||||
"type": 3,
|
||||
"api": "assets://js/mybili_open.js"
|
||||
},
|
||||
{
|
||||
"key": "kuqimv",
|
||||
"name": "Cat_open_js_酷奇|猫影视app",
|
||||
"type": 3,
|
||||
"api": "assets://js/kuqimv_open.js"
|
||||
},
|
||||
{
|
||||
"key": "230ts",
|
||||
"name": "Cat_open_js_听书|猫影视app",
|
||||
"type": 3,
|
||||
"api": "assets://js/230ts_open.js"
|
||||
}
|
||||
]
|
||||
},
|
||||
"pan": {
|
||||
"sites": [
|
||||
{
|
||||
"key": "alist",
|
||||
"name": "Alist",
|
||||
"type": 40,
|
||||
"api": "assets://js/alist_open.js",
|
||||
"ext": [
|
||||
{
|
||||
"name": "🙋丫仙女",
|
||||
"server": "http://alist.xiaoya.pro/",
|
||||
"startPage": "/",
|
||||
"showAll": false,
|
||||
"search": true,
|
||||
"headers": {
|
||||
"Authorization": ""
|
||||
},
|
||||
"params": {
|
||||
"/abc": {
|
||||
"password": "123"
|
||||
},
|
||||
"/abc/abc": {
|
||||
"password": "123"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "🐋一只鱼",
|
||||
"server": "https://alist.youte.ml"
|
||||
},
|
||||
{
|
||||
"name": "杜比",
|
||||
"server": "https://dubi.tk"
|
||||
},
|
||||
{
|
||||
"name": "资源",
|
||||
"server": "https://pan.ecve.cn"
|
||||
},
|
||||
{
|
||||
"name": "🌊七米蓝",
|
||||
"server": "https://al.chirmyram.com"
|
||||
},
|
||||
{
|
||||
"name": "🐉神族九帝",
|
||||
"server": "https://alist.shenzjd.com"
|
||||
},
|
||||
{
|
||||
"name": "☃️姬路白雪",
|
||||
"server": "https://pan.jlbx.xyz"
|
||||
},
|
||||
{
|
||||
"name": "✨星梦",
|
||||
"server": "https://pan.bashroot.top"
|
||||
},
|
||||
{
|
||||
"name": "💢repl",
|
||||
"server": "https://ali.liucn.repl.co"
|
||||
},
|
||||
{
|
||||
"name": "💦讯维云盘",
|
||||
"server": "https://pan.xwbeta.com"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
125
cat_js.json
Normal file
125
cat_js.json
Normal file
@ -0,0 +1,125 @@
|
||||
{
|
||||
"sites": [
|
||||
{
|
||||
"key": "drpy_js_boosj_open",
|
||||
"name": "童趣┃猫",
|
||||
"type": 3,
|
||||
"api": "assets://js/boosj_open.js"
|
||||
},
|
||||
{
|
||||
"key": "drpy_js_tuxiaobei_open",
|
||||
"name": "兔小贝┃猫",
|
||||
"type": 3,
|
||||
"api": "assets://js/tuxiaobei_open.js"
|
||||
},
|
||||
{
|
||||
"key": "drpy_js_ubestkid_open",
|
||||
"name": "贝乐虎┃猫",
|
||||
"type": 3,
|
||||
"api": "assets://js/ubestkid_open.js"
|
||||
},
|
||||
{
|
||||
"key": "drpy_js_dj0898_open",
|
||||
"name": "世纪DJ┃猫",
|
||||
"type": 3,
|
||||
"api": "assets://js/dj0898_open.js"
|
||||
},
|
||||
{
|
||||
"key": "drpy_js_zxzj_open",
|
||||
"name": "在线之家┃猫",
|
||||
"type": 3,
|
||||
"api": "assets://js/zxzj_open.js"
|
||||
},
|
||||
{
|
||||
"key": "drpy_js_cntv_open",
|
||||
"name": "视聚场┃猫",
|
||||
"type": 3,
|
||||
"api": "assets://js/cntv_open.js"
|
||||
},
|
||||
{
|
||||
"key": "drpy_js_bili_open",
|
||||
"name": "哔哩合集┃猫",
|
||||
"type": 3,
|
||||
"api": "assets://js/bili_open.js"
|
||||
},
|
||||
{
|
||||
"key": "wogg",
|
||||
"name": "Cat_open_js_玩偶|猫影视app",
|
||||
"type": 3,
|
||||
"api": "assets://js/wogg_open.js",
|
||||
"ext": "8069d2ca50c749ed932e171fb2a41b95"
|
||||
},
|
||||
{
|
||||
"key": "kunyu77",
|
||||
"name": "Cat_open_js_鲲鱼|猫影视app",
|
||||
"type": 3,
|
||||
"api": "assets://js/kunyu77_open.js"
|
||||
},
|
||||
{
|
||||
"key": "czzy",
|
||||
"name": "Cat_open_js_厂长|猫影视app",
|
||||
"type": 3,
|
||||
"api": "assets://js/czzy_open.js"
|
||||
},
|
||||
{
|
||||
"key": "libvio",
|
||||
"name": "Cat_open_js_黎波|猫影视app",
|
||||
"type": 3,
|
||||
"api": "assets://js/libvio_open.js"
|
||||
},
|
||||
{
|
||||
"key": "kkys",
|
||||
"name": "Cat_open_js_快看|猫影视app",
|
||||
"type": 3,
|
||||
"api": "assets://js/kkys_open.js"
|
||||
},
|
||||
{
|
||||
"key": "ikanbot",
|
||||
"name": "Cat_open_js_爱看|猫影视app",
|
||||
"type": 3,
|
||||
"api": "assets://js/ikanbot_open.js"
|
||||
},
|
||||
{
|
||||
"key": "ngys",
|
||||
"name": "Cat_open_js_南瓜|猫影视app",
|
||||
"type": 3,
|
||||
"api": "assets://js/ng_open.js"
|
||||
},
|
||||
{
|
||||
"key": "duboku",
|
||||
"name": "Cat_open_js_独播库|猫影视app",
|
||||
"type": 3,
|
||||
"api": "assets://js/duboku_open.js"
|
||||
},
|
||||
{
|
||||
"key": "subaibai",
|
||||
"name": "Cat_open_js_素白白|猫影视app",
|
||||
"type": 3,
|
||||
"api": "assets://js/subaibai_open.js"
|
||||
},
|
||||
{
|
||||
"key": "sharenice",
|
||||
"name": "Cat_open_js_短视频|猫影视app",
|
||||
"type": 3,
|
||||
"api": "assets://js/sharenice_open.js"
|
||||
},
|
||||
{
|
||||
"key": "mybili",
|
||||
"name": "Cat_open_js_哔哩|猫影视app",
|
||||
"type": 3,
|
||||
"api": "assets://js/mybili_open.js"
|
||||
},
|
||||
{
|
||||
"key": "kuqimv",
|
||||
"name": "Cat_open_js_酷奇|猫影视app",
|
||||
"type": 3,
|
||||
"api": "assets://js/kuqimv_open.js"
|
||||
},
|
||||
{
|
||||
"key": "230ts",
|
||||
"name": "Cat_open_js_听书|猫影视app",
|
||||
"type": 3,
|
||||
"api": "assets://js/230ts_open.js"
|
||||
}
|
||||
]
|
||||
}
|
253
js/230ts_open.js
Normal file
253
js/230ts_open.js
Normal file
@ -0,0 +1,253 @@
|
||||
// 网站搜索异常
|
||||
import { load, _ } from './lib/cat.js';
|
||||
|
||||
let key = '爱上你听书网';
|
||||
let HOST = 'https://wap.230ts.net';
|
||||
let siteKey = '';
|
||||
let siteType = 0;
|
||||
const MOBILE_UA = 'Mozilla/5.0 (Linux; Android 11; M2007J3SC Build/RKQ1.200826.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045714 Mobile Safari/537.36';
|
||||
|
||||
async function request(reqUrl, agentSp) {
|
||||
let res = await req(reqUrl, {
|
||||
method: 'get',
|
||||
headers: {
|
||||
'User-Agent': agentSp || MOBILE_UA,
|
||||
'Referer': HOST
|
||||
},
|
||||
});
|
||||
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(HOST + '/sort/');
|
||||
const $ = load(html);
|
||||
let filterObj = {};
|
||||
const class_parse = $('dl.pd-class:first > dd > a[href*=sort]');
|
||||
let classes = [];
|
||||
classes = _.map(class_parse, (cls) => {
|
||||
let typeId = cls.attribs['href'];
|
||||
typeId = typeId.replace(/.*?\/sort\/(.*).html/g, '$1');
|
||||
return {
|
||||
type_id: typeId,
|
||||
type_name: cls.children[0].data,
|
||||
};
|
||||
});
|
||||
const sortName = ['玄幻有声', '灵异有声', '综艺娱乐', '长篇评书', '都市有声', '军事有声', '职场有声', '其他有声'];
|
||||
classes = _.sortBy(classes, (c) => {
|
||||
const index = sortName.indexOf(c.type_name);
|
||||
return index === -1 ? sortName.length : index;
|
||||
});
|
||||
return JSON.stringify({
|
||||
class: classes,
|
||||
filters: filterObj,
|
||||
});
|
||||
}
|
||||
|
||||
async function homeVod() {
|
||||
const link = HOST + '/top/lastupdate/1.html';
|
||||
const html = await request(link);
|
||||
const $ = load(html);
|
||||
const items = $('ul.list-ul > li');
|
||||
let videos = _.map(items, (item) => {
|
||||
const it = $(item).find('a:first')[0];
|
||||
const img = $(item).find('img:first')[0];
|
||||
const remarks = $($(item).find('p.module-slide-author')[0]).text().trim();
|
||||
return {
|
||||
vod_id: it.attribs.href.replace(/.*?\/tingshu\/(.*)/g, '$1'),
|
||||
vod_name: it.attribs.title.replace('有声小说',''),
|
||||
vod_pic: HOST + img.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 = HOST + '/sort/' + tid +'/' + (`${pg}`) + '.html';
|
||||
const html = await request(link);
|
||||
const $ = load(html);
|
||||
const items = $('ul.book-ol > li');
|
||||
let videos = _.map(items, (item) => {
|
||||
const it = $(item).find('a:first')[0];
|
||||
const img = $(item).find('img:first')[0];
|
||||
const remarks = $($(item).find('div.book-meta')[0]).text().trim();
|
||||
return {
|
||||
vod_id: it.attribs.href.replace(/.*?\/tingshu\/(.*)/g, '$1'),
|
||||
vod_name: it.attribs.title.replace('有声小说',''),
|
||||
vod_pic: HOST + img.attribs['data-original'],
|
||||
vod_remarks: remarks.replace('佚名(著)','').replace('佚名(播)','').replace('未知(著)','').replace('未知(播)','') || '',
|
||||
};
|
||||
});
|
||||
const hasMore = $('div.paging > 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(HOST + '/tingshu/' + id);
|
||||
const $ = load(html);
|
||||
const detail = $('div.book-cell:first > div');
|
||||
let vod = {
|
||||
vod_id: id,
|
||||
vod_name: $('h1:first').text().trim().replace('有声小说',''),
|
||||
vod_pic: HOST + $('div.myui-content__thumb img:first').attr('data-original'),
|
||||
vod_content: $('div.ellipsis').text().trim(),
|
||||
};
|
||||
for (const info of detail) {
|
||||
const i = $(info).text().trim();
|
||||
if (i.startsWith('类型:')) {
|
||||
vod.vod_type = _.map($(info).find('a'), (a) => {
|
||||
return a.children[0].data;
|
||||
}).join('/');
|
||||
} else if (i.startsWith('作者:')) {
|
||||
vod.vod_director = _.map($(info).find('a'), (a) => {
|
||||
return a.children[0].data;
|
||||
}).join('/');
|
||||
} else if (i.startsWith('演播:')) {
|
||||
vod.vod_actor = _.map($(info).find('a'), (a) => {
|
||||
return a.children[0].data;
|
||||
}).join('/');
|
||||
} else if (i.startsWith('连载中')) {
|
||||
vod.vod_remarks = i.substring(3);
|
||||
}
|
||||
}
|
||||
const playlist = _.map($('#playlist > ul > li > a'), (it) => {
|
||||
return it.children[0].data + '$' + it.attribs.href.replace(/\/mp3\/(.*).html/g, '$1');
|
||||
});
|
||||
vod.vod_play_from = '道长在线';
|
||||
vod.vod_play_url = playlist.join('#');
|
||||
return JSON.stringify({
|
||||
list: [vod],
|
||||
});
|
||||
}
|
||||
|
||||
async function play(flag, id, flags) {
|
||||
const link = HOST + '/mp3/' + id + '.html';
|
||||
const html = await request(link);
|
||||
const $ = load(html);
|
||||
const iframe = $('body iframe[src*=player]');
|
||||
const iframeHtml = (
|
||||
await req(HOST + iframe[0].attribs.src, {
|
||||
headers: {
|
||||
'Referer': link,
|
||||
'User-Agent': MOBILE_UA,
|
||||
},
|
||||
})
|
||||
).content;
|
||||
const playUrl = iframeHtml.match(/mp3:'(.*?)'/)[1];
|
||||
if (playUrl.indexOf('m4a') >= 0 || playUrl.indexOf('mp3') >= 0 ) {
|
||||
return JSON.stringify({
|
||||
parse: 0,
|
||||
url: playUrl,
|
||||
});
|
||||
} else {
|
||||
try {
|
||||
const iframeHtml = (
|
||||
await req(HOST + iframe[0].attribs.src, {
|
||||
headers: {
|
||||
'Referer': link,
|
||||
'User-Agent': MOBILE_UA,
|
||||
},
|
||||
})
|
||||
).content;
|
||||
const playUrl = playUrl + '.m4a' + iframeHtml.match(/(\?.*?)'/)[1];
|
||||
if (playUrl.indexOf('http') >= 0) {
|
||||
return JSON.stringify({
|
||||
parse: 0,
|
||||
url: playUrl,
|
||||
});
|
||||
} else {
|
||||
const iframeHtml = (
|
||||
await req(HOST + iframe[0].attribs.src, {
|
||||
headers: {
|
||||
'Referer': link,
|
||||
'User-Agent': MOBILE_UA,
|
||||
},
|
||||
})
|
||||
).content;
|
||||
const playUrl2 = iframeHtml.match(/url[\s\S]*?(http.*?)'/)[1];
|
||||
if (playUrl2.indexOf('\?') >= 0) {
|
||||
return JSON.stringify({
|
||||
parse: 0,
|
||||
url: playUrl2,
|
||||
});
|
||||
} else {
|
||||
const playUrl3 = playUrl2 + playUrl
|
||||
return JSON.stringify({
|
||||
parse: 0,
|
||||
url: playUrl3,
|
||||
});
|
||||
}
|
||||
}
|
||||
} catch (e) {}
|
||||
if (playUrl.indexOf('http') >= 0) {
|
||||
const playUrl = playUrl + '.m4a';
|
||||
return JSON.stringify({
|
||||
parse: 0,
|
||||
url: playUrl,
|
||||
});
|
||||
} else {
|
||||
const iframeHtml = (
|
||||
await req(HOST + iframe[0].attribs.src, {
|
||||
headers: {
|
||||
'Referer': link,
|
||||
'User-Agent': MOBILE_UA,
|
||||
},
|
||||
})
|
||||
).content;
|
||||
const playUrl4 = iframeHtml.match(/url[\s\S]*?(http.*?)'/)[1];
|
||||
return JSON.stringify({
|
||||
parse: 0,
|
||||
url: playUrl4 + '.m4a',
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function search(wd, quick) {
|
||||
const link = HOST + '/search.html?searchtype=name&searchword=' + wd +'&page=1';
|
||||
const html = await request(link);
|
||||
const $ = load(html);
|
||||
const items = $('ul.book-ol > li');
|
||||
let videos = _.map(items, (item) => {
|
||||
const it = $(item).find('a:first')[0];
|
||||
const img = $(item).find('img:first')[0];
|
||||
const remarks = $($(item).find('div.book-meta')[0]).text().trim();
|
||||
return {
|
||||
vod_id: it.attribs.href.replace(/.*?\/tingshu\/(.*)/g, '$1'),
|
||||
vod_name: it.attribs.title.replace('有声小说',''),
|
||||
vod_pic: img.attribs['data-original'],
|
||||
vod_remarks: remarks.replace('佚名(著)','').replace('佚名(播)','').replace('未知(著)','').replace('未知(播)','') || '',
|
||||
};
|
||||
});
|
||||
return JSON.stringify({
|
||||
list: videos,
|
||||
});
|
||||
}
|
||||
|
||||
export function __jsEvalReturn() {
|
||||
return {
|
||||
init: init,
|
||||
home: home,
|
||||
homeVod: homeVod,
|
||||
category: category,
|
||||
detail: detail,
|
||||
play: play,
|
||||
search: search,
|
||||
};
|
||||
}
|
275
js/alist_open.js
Normal file
275
js/alist_open.js
Normal file
@ -0,0 +1,275 @@
|
||||
import { _ } from './lib/cat.js';
|
||||
import { findBestLCS } from './lib/similarity.js';
|
||||
|
||||
const http = async 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);
|
||||
}
|
||||
const res = await req(url, options);
|
||||
res.json = () => (res.content ? JSON.parse(res.content) : null);
|
||||
res.text = () => res.content;
|
||||
return res;
|
||||
};
|
||||
['get', 'post'].forEach((method) => {
|
||||
http[method] = function (url, options = {}) {
|
||||
return http(url, Object.assign(options, { method: method.toUpperCase() }));
|
||||
};
|
||||
});
|
||||
|
||||
const __drives = {};
|
||||
const __subtitle_cache = {};
|
||||
|
||||
async function get_drives_path(tid) {
|
||||
const index = tid.indexOf('/', 1);
|
||||
const name = tid.substring(1, index);
|
||||
const path = tid.substring(index);
|
||||
return { drives: await get_drives(name), path };
|
||||
}
|
||||
|
||||
async function get_drives(name) {
|
||||
const { settings, api, server } = __drives[name];
|
||||
if (settings.v3 == null) {
|
||||
//获取 设置
|
||||
settings.v3 = false;
|
||||
const data = (await http.get(server + '/api/public/settings')).json().data;
|
||||
if (_.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; //v3 没有找到 搜索配置
|
||||
}
|
||||
//不同版本 接口不一样
|
||||
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';
|
||||
api.other = settings.v3 ? '/api/fs/other' : null;
|
||||
}
|
||||
return __drives[name];
|
||||
}
|
||||
|
||||
let siteKey = '';
|
||||
let siteType = 0;
|
||||
|
||||
function init(cfg) {
|
||||
siteKey = cfg.skey;
|
||||
siteType = cfg.stype;
|
||||
cfg.ext.forEach(
|
||||
(item) =>
|
||||
(__drives[item.name] = {
|
||||
name: item.name,
|
||||
server: item.server.endsWith('/') ? item.server.substring(0, item.server.length - 1) : item.server,
|
||||
startPage: item.startPage || '/', //首页
|
||||
showAll: item.showAll === true, //默认只显示 视频和文件夹,如果想显示全部 showAll 设置true
|
||||
params: item.params || {},
|
||||
_path_param: item.params
|
||||
? _.sortBy(Object.keys(item.params), function (x) {
|
||||
return -x.length;
|
||||
})
|
||||
: [],
|
||||
settings: {},
|
||||
api: {},
|
||||
getParams(path) {
|
||||
const key = this._path_param.find((x) => path.startsWith(x));
|
||||
return Object.assign({}, this.params[key], { path });
|
||||
},
|
||||
async getPath(path) {
|
||||
const res = (await http.post(this.server + this.api.path, { data: this.getParams(path) })).json();
|
||||
return this.settings.v3 ? res.data.content : res.data.files;
|
||||
},
|
||||
async getFile(path) {
|
||||
const res = (await http.post(this.server + this.api.file, { data: this.getParams(path) })).json();
|
||||
const data = this.settings.v3 ? res.data : res.data.files[0];
|
||||
if (!this.settings.v3) data.raw_url = data.url; //v2 的url和v3不一样
|
||||
return data;
|
||||
},
|
||||
async getOther(method, path) {
|
||||
const data = this.getParams(path);
|
||||
data.method = method;
|
||||
const res = (await http.post(this.server + this.api.other, { data: data })).json();
|
||||
return res;
|
||||
},
|
||||
isFolder(data) {
|
||||
return data.type == 1;
|
||||
},
|
||||
isVideo(data) {
|
||||
//判断是否是 视频文件
|
||||
return this.settings.v3 ? data.type == 2 : data.type == 3;
|
||||
},
|
||||
isSubtitle(data) {
|
||||
if (data.type == 1) return false;
|
||||
const ext = ['.srt', '.ass', '.scc', '.stl', '.ttml'];
|
||||
return ext.some((x) => data.name.endsWith(x));
|
||||
},
|
||||
getType(data) {
|
||||
const isVideo = this.isVideo(data);
|
||||
return this.isFolder(data) ? 0 : isVideo ? 10 : 1;
|
||||
},
|
||||
getPic(data) {
|
||||
let pic = this.settings.v3 ? data.thumb : data.thumbnail;
|
||||
return pic || (this.isFolder(data) ? 'http://img1.3png.com/281e284a670865a71d91515866552b5f172b.png' : '');
|
||||
},
|
||||
getSize(data) {
|
||||
let sz = data.size || 0;
|
||||
if (sz <= 0) return '';
|
||||
let filesize = '';
|
||||
if (sz > 1024 * 1024 * 1024 * 1024.0) {
|
||||
sz /= 1024 * 1024 * 1024 * 1024.0;
|
||||
filesize = 'TB';
|
||||
} else if (sz > 1024 * 1024 * 1024.0) {
|
||||
sz /= 1024 * 1024 * 1024.0;
|
||||
filesize = 'GB';
|
||||
} else if (sz > 1024 * 1024.0) {
|
||||
sz /= 1024 * 1024.0;
|
||||
filesize = 'MB';
|
||||
} else {
|
||||
sz /= 1024.0;
|
||||
filesize = 'KB';
|
||||
}
|
||||
return sz.toFixed(2) + filesize;
|
||||
},
|
||||
getRemark(data) {
|
||||
return '';
|
||||
},
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
async function dir(dir, pg) {
|
||||
for (const k in __subtitle_cache) {
|
||||
delete __subtitle_cache[k];
|
||||
}
|
||||
pg = pg || 1;
|
||||
if (pg == 0) pg == 1;
|
||||
if (dir === '/' || dir === '') {
|
||||
const result = _.map(__drives, function (d) {
|
||||
return { name: d.name, path: '/' + d.name + d.startPage, type: 0, thumb: '' };
|
||||
});
|
||||
return JSON.stringify({
|
||||
parent: '',
|
||||
page: pg,
|
||||
pagecount: pg,
|
||||
list: result,
|
||||
});
|
||||
}
|
||||
|
||||
let { drives, path } = await get_drives_path(dir);
|
||||
const id = dir.endsWith('/') ? dir : dir + '/';
|
||||
const list = await drives.getPath(path);
|
||||
let subtList = [];
|
||||
let videos = [];
|
||||
let allList = [];
|
||||
list.forEach((item) => {
|
||||
if (drives.isSubtitle(item)) subtList.push(item.name);
|
||||
const isVideo = drives.isVideo(item);
|
||||
if (!drives.showAll && !drives.isFolder(item) && !isVideo) return;
|
||||
const file = {
|
||||
name: item.name.replaceAll('$', '_').replaceAll('#', '_'),
|
||||
path: id + item.name + (drives.isFolder(item) ? '/' : ''),
|
||||
thumb: drives.getPic(item),
|
||||
type: drives.getType(item),
|
||||
size: drives.getSize(item),
|
||||
remark: drives.getRemark(item),
|
||||
};
|
||||
if (drives.isVideo(item)) videos.push(file);
|
||||
allList.push(file);
|
||||
});
|
||||
if (subtList.length > 0) {
|
||||
videos.forEach((item) => {
|
||||
var sbust = findBestLCS(item.name, subtList);
|
||||
if (sbust.bestMatch) __subtitle_cache[item.path] = [id + sbust.bestMatch.target];
|
||||
});
|
||||
}
|
||||
return JSON.stringify({
|
||||
parent: id,
|
||||
page: pg,
|
||||
pagecount: pg,
|
||||
list: allList,
|
||||
});
|
||||
}
|
||||
|
||||
async function file(file) {
|
||||
let { drives, path } = await get_drives_path(file);
|
||||
const item = await drives.getFile(path);
|
||||
const subs = [];
|
||||
if (__subtitle_cache[file]) {
|
||||
for (const sub of __subtitle_cache[file]) {
|
||||
try {
|
||||
let subP = await get_drives_path(sub);
|
||||
const subItem = await drives.getFile(subP.path);
|
||||
subs.push(subItem.raw_url);
|
||||
} catch (error) {}
|
||||
}
|
||||
}
|
||||
if (item.provider === 'AliyundriveShare2Open' && drives.api.other) {
|
||||
const urls = ['原画', item.raw_url];
|
||||
try {
|
||||
const res = await drives.getOther('video_preview', path);
|
||||
for (const live of res.data.video_preview_play_info.live_transcoding_task_list) {
|
||||
if (live.status === 'finished') {
|
||||
urls.push(live.template_id);
|
||||
urls.push(live.url);
|
||||
}
|
||||
}
|
||||
} catch (error) {}
|
||||
const result = {
|
||||
name: item.name,
|
||||
url: urls,
|
||||
size: drives.getSize(item),
|
||||
remark: drives.getRemark(item),
|
||||
header: {},
|
||||
extra: {
|
||||
subt: subs,
|
||||
},
|
||||
};
|
||||
return JSON.stringify(result);
|
||||
} else if (item.provider === '123Pan') {
|
||||
let url = item.raw_url;
|
||||
try {
|
||||
url = (await http.get(url)).json().data.redirect_url;
|
||||
} catch (error) {}
|
||||
const result = {
|
||||
name: item.name,
|
||||
url: url,
|
||||
size: drives.getSize(item),
|
||||
remark: drives.getRemark(item),
|
||||
header: {},
|
||||
extra: {
|
||||
subt: subs,
|
||||
},
|
||||
};
|
||||
return JSON.stringify(result);
|
||||
} else {
|
||||
const result = {
|
||||
name: item.name,
|
||||
url: item.raw_url,
|
||||
size: drives.getSize(item),
|
||||
remark: drives.getRemark(item),
|
||||
header: {},
|
||||
extra: {
|
||||
subt: subs,
|
||||
},
|
||||
};
|
||||
return JSON.stringify(result);
|
||||
}
|
||||
}
|
||||
|
||||
function search(wd) {
|
||||
return JSON.stringify({
|
||||
list: [],
|
||||
});
|
||||
}
|
||||
|
||||
export function __jsEvalReturn() {
|
||||
return {
|
||||
init: init,
|
||||
dir: dir,
|
||||
file: file,
|
||||
search: search,
|
||||
};
|
||||
}
|
8
js/app.js
Normal file
8
js/app.js
Normal file
@ -0,0 +1,8 @@
|
||||
function __jsEvalReturn() {
|
||||
return {
|
||||
isVideoFormat: function (url) {
|
||||
return !0;
|
||||
},
|
||||
};
|
||||
}
|
||||
export { __jsEvalReturn };
|
508
js/bili_open.js
Normal file
508
js/bili_open.js
Normal file
@ -0,0 +1,508 @@
|
||||
import { Crypto, _ } from './lib/cat.js';
|
||||
|
||||
let siteKey = '';
|
||||
let siteType = 0;
|
||||
|
||||
let cookie = '';
|
||||
let login = '';
|
||||
let vip = '';
|
||||
let extendObj = {};
|
||||
let vod_audio_id = {
|
||||
30280: 192000,
|
||||
30232: 132000,
|
||||
30216: 64000,
|
||||
};
|
||||
let vod_codec = {
|
||||
// 13: 'AV1',
|
||||
12: 'HEVC',
|
||||
7: 'AVC',
|
||||
};
|
||||
|
||||
const UA = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36';
|
||||
|
||||
async function request(reqUrl, ua) {
|
||||
let res = await req(reqUrl, {
|
||||
method: 'get',
|
||||
headers: ua ? ua : { 'User-Agent': UA },
|
||||
timeout: 60000,
|
||||
});
|
||||
return res.content;
|
||||
}
|
||||
|
||||
function getHeaders() {
|
||||
const headers = {
|
||||
'User-Agent': UA,
|
||||
};
|
||||
if (!_.isEmpty(cookie)) {
|
||||
headers.cookie = cookie;
|
||||
}
|
||||
return headers;
|
||||
}
|
||||
|
||||
async function getCookie() {
|
||||
let result = await req('https://www.bilibili.com', {
|
||||
method: 'get',
|
||||
headers: { 'User-Agent': UA },
|
||||
timeout: 60000,
|
||||
});
|
||||
const setCookieHeaders = result.headers['set-cookie'];
|
||||
cookie = setCookieHeaders.map((kk) => kk.split(';')[0] + ';').join('');
|
||||
}
|
||||
|
||||
async function init(cfg) {
|
||||
siteKey = cfg.skey;
|
||||
siteType = cfg.stype;
|
||||
let extend = cfg.ext;
|
||||
if (cfg.ext.hasOwnProperty('categories')) extend = cfg.ext.categories;
|
||||
if (cfg.ext.hasOwnProperty('cookie')) cookie = cfg.ext.cookie;
|
||||
if (_.isEmpty(cookie)) await getCookie();
|
||||
let result = JSON.parse(await request('https://api.bilibili.com/x/web-interface/nav', getHeaders()));
|
||||
login = result.data.isLogin;
|
||||
vip = result.data.hasOwnProperty('vipStatus');
|
||||
const ext = extend.split('#');
|
||||
const jsonData = [
|
||||
{
|
||||
key: 'order',
|
||||
name: '排序',
|
||||
value: [
|
||||
{ n: '综合排序', v: '0' },
|
||||
{ n: '最多点击', v: 'click' },
|
||||
{ n: '最新发布', v: 'pubdate' },
|
||||
{ n: '最多弹幕', v: 'dm' },
|
||||
{ n: '最多收藏', v: 'stow' },
|
||||
],
|
||||
},
|
||||
{
|
||||
key: 'duration',
|
||||
name: '时长',
|
||||
value: [
|
||||
{ n: '全部时长', v: '0' },
|
||||
{ n: '60分钟以上', v: '4' },
|
||||
{ n: '30~60分钟', v: '3' },
|
||||
{ n: '10~30分钟', v: '2' },
|
||||
{ n: '10分钟以下', v: '1' },
|
||||
],
|
||||
},
|
||||
];
|
||||
const newarr = [];
|
||||
const d = {};
|
||||
for (const kk of ext) {
|
||||
const c = {
|
||||
type_name: kk,
|
||||
type_id: kk,
|
||||
land: 1,
|
||||
ratio: 1.78,
|
||||
};
|
||||
newarr.push(c);
|
||||
d[kk] = jsonData;
|
||||
}
|
||||
extendObj = {
|
||||
classes: newarr,
|
||||
filter: d,
|
||||
};
|
||||
}
|
||||
|
||||
function home(filter) {
|
||||
try {
|
||||
const jSONObject = {
|
||||
class: extendObj.classes,
|
||||
};
|
||||
if (filter) {
|
||||
jSONObject.filters = extendObj.filter;
|
||||
}
|
||||
return JSON.stringify(jSONObject);
|
||||
} catch (e) {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
async function homeVod() {
|
||||
try {
|
||||
const list = [];
|
||||
const type_id = extendObj.classes[0].type_id;
|
||||
const url = `https://api.bilibili.com/x/web-interface/search/type?search_type=video&keyword=${type_id}&duration=4`;
|
||||
|
||||
const response = await request(url, getHeaders());
|
||||
const responseData = JSON.parse(response);
|
||||
const vods = responseData.data.result;
|
||||
|
||||
for (const item of vods) {
|
||||
const vod = {};
|
||||
let imageUrl = item.pic;
|
||||
if (imageUrl.startsWith('//')) {
|
||||
imageUrl = 'https:' + imageUrl;
|
||||
}
|
||||
|
||||
vod.vod_id = item.bvid;
|
||||
vod.vod_name = removeTags(item.title);
|
||||
vod.vod_pic = imageUrl;
|
||||
vod.vod_remarks = item.duration.split(':')[0] + '分钟';
|
||||
list.push(vod);
|
||||
}
|
||||
|
||||
const result = { list: list };
|
||||
return JSON.stringify(result);
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
async function category(tid, page, filter, ext) {
|
||||
if (page < 1) page = 1;
|
||||
try {
|
||||
if (Object.keys(ext).length > 0 && ext.hasOwnProperty('tid') && ext['tid'].length > 0) {
|
||||
tid = ext['tid'];
|
||||
}
|
||||
let url = `https://api.bilibili.com/x/web-interface/search/type?search_type=video&keyword=${encodeURIComponent(tid)}`;
|
||||
|
||||
if (Object.keys(ext).length > 0) {
|
||||
for (const k in ext) {
|
||||
if (k == 'tid') {
|
||||
continue;
|
||||
}
|
||||
url += `&${encodeURIComponent(k)}=${encodeURIComponent(ext[k])}`;
|
||||
}
|
||||
}
|
||||
|
||||
url += `&page=${encodeURIComponent(page)}`;
|
||||
|
||||
const response = await request(url, getHeaders());
|
||||
|
||||
const resp = JSON.parse(response);
|
||||
const data = resp.data;
|
||||
|
||||
const videos = [];
|
||||
const items = data.result;
|
||||
|
||||
for (const item of items) {
|
||||
const video = {};
|
||||
let pic = item.pic;
|
||||
if (pic.startsWith('//')) {
|
||||
pic = 'https:' + pic;
|
||||
}
|
||||
|
||||
video.vod_id = item.bvid;
|
||||
video.vod_name = removeTags(item.title);
|
||||
video.vod_pic = pic;
|
||||
video.vod_remarks = item.duration.split(':')[0] + '分钟';
|
||||
videos.push(video);
|
||||
}
|
||||
|
||||
const result = {
|
||||
page: page,
|
||||
pagecount: data.numPages,
|
||||
limit: data.pagesize,
|
||||
total: data.numResults,
|
||||
list: videos,
|
||||
};
|
||||
|
||||
return JSON.stringify(result);
|
||||
} catch (e) {}
|
||||
return null;
|
||||
}
|
||||
|
||||
async function detail(ids) {
|
||||
try {
|
||||
const bvid = ids;
|
||||
const bvid2aidUrl = `https://api.bilibili.com/x/web-interface/archive/stat?bvid=${bvid}`;
|
||||
|
||||
const bvid2aidResp = JSON.parse(await request(bvid2aidUrl, getHeaders()));
|
||||
|
||||
const aid = bvid2aidResp.data.aid + '';
|
||||
const detailUrl = `https://api.bilibili.com/x/web-interface/view?aid=${aid}`;
|
||||
const detailData = JSON.parse(await request(detailUrl, getHeaders())).data;
|
||||
|
||||
const video = {
|
||||
vod_id: bvid,
|
||||
vod_name: detailData.title,
|
||||
vod_pic: detailData.pic,
|
||||
type_name: detailData.tname,
|
||||
vod_year: '',
|
||||
vod_area: '',
|
||||
vod_remarks: `${Math.floor(detailData.duration / 60)}分钟`,
|
||||
vod_actor: '',
|
||||
vod_director: '',
|
||||
vod_content: detailData.desc,
|
||||
};
|
||||
|
||||
const playurldata = 'https://api.bilibili.com/x/player/playurl?avid=' + aid + '&cid=' + detailData.cid + '&qn=127&fnval=4048&fourk=1';
|
||||
const playurldatas = JSON.parse(await request(playurldata, getHeaders()));
|
||||
|
||||
const playurldatalist = playurldatas.data;
|
||||
const a = playurldatalist.accept_description;
|
||||
const accept_quality = playurldatalist.accept_quality;
|
||||
const Aq = [];
|
||||
const pFrom = [];
|
||||
|
||||
for (let i = 0; i < accept_quality.length; i++) {
|
||||
if (!login) {
|
||||
if (accept_quality[i] > 32) continue;
|
||||
} else if (!vip && login) {
|
||||
if (accept_quality[i] > 80) continue;
|
||||
} else {
|
||||
if (accept_quality[i] > 32) continue;
|
||||
}
|
||||
pFrom.push(a[i]);
|
||||
Aq.push(accept_quality[i]);
|
||||
}
|
||||
|
||||
const jSONArray = detailData.pages;
|
||||
const playList = [];
|
||||
for (let j = 0; j < jSONArray.length; j++) {
|
||||
const jSONObject6 = jSONArray[j];
|
||||
const j2 = jSONObject6.cid;
|
||||
const playUrl = j + '$' + aid + '+' + j2 + '+' + Aq.join(':') + '+' + pFrom.join(':');
|
||||
playList.push(playUrl);
|
||||
}
|
||||
|
||||
video.vod_play_from = 'external$$$dash$$$mp4';
|
||||
video.vod_play_url = playList.join('#');
|
||||
video.vod_play_url = [video.vod_play_url, video.vod_play_url, video.vod_play_url].join('$$$');
|
||||
|
||||
const list = [video];
|
||||
const result = { list };
|
||||
return JSON.stringify(result);
|
||||
} catch (e) {}
|
||||
return null;
|
||||
}
|
||||
|
||||
async function play(flag, id, flags) {
|
||||
try {
|
||||
const playHeaders = { Referer: 'https://www.bilibili.com', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36' };
|
||||
const ids = id.split('+');
|
||||
const aid = ids[0];
|
||||
const cid = ids[1];
|
||||
const qualityIds = ids[2].split(':');
|
||||
const qualityName = ids[3].split(':');
|
||||
if (flag == 'dash') {
|
||||
// dash mpd 代理
|
||||
const js2Base = await js2Proxy(true, siteType, siteKey, 'dash/', {});
|
||||
let urls = [];
|
||||
for (let i = 0; i < qualityIds.length; i++) {
|
||||
urls.push(qualityName[i], js2Base + base64Encode(aid + '+' + cid + '+' + qualityIds[i]));
|
||||
}
|
||||
return JSON.stringify({
|
||||
parse: 0,
|
||||
url: urls,
|
||||
header: playHeaders,
|
||||
});
|
||||
} else if (flag == 'mp4') {
|
||||
// 直链
|
||||
let urls = [];
|
||||
for (let i = 0; i < qualityIds.length; i++) {
|
||||
const url = `https://api.bilibili.com/x/player/playurl?avid=${aid}&cid=${cid}&qn=${qualityIds[i]}&fourk=1`;
|
||||
const resp = JSON.parse(await request(url, getHeaders()));
|
||||
const data = resp.data;
|
||||
if (data.quality != qualityIds[i]) continue;
|
||||
let durl = data.durl[0].url;
|
||||
urls.push(qualityName[i], durl);
|
||||
}
|
||||
|
||||
return JSON.stringify({
|
||||
parse: 0,
|
||||
url: urls,
|
||||
header: playHeaders,
|
||||
});
|
||||
} else {
|
||||
// 音频外挂
|
||||
let urls = [];
|
||||
let audios = [];
|
||||
for (let i = 0; i < qualityIds.length; i++) {
|
||||
const url = `https://api.bilibili.com/x/player/playurl?avid=${aid}&cid=${cid}&qn=${qualityIds[i]}&fnval=4048&fourk=1`;
|
||||
let resp = JSON.parse(await request(url, getHeaders()));
|
||||
const dash = resp.data.dash;
|
||||
const video = dash.video;
|
||||
const audio = dash.audio;
|
||||
for (let j = 0; j < video.length; j++) {
|
||||
const dashjson = video[j];
|
||||
if (dashjson.id == qualityIds[i]) {
|
||||
for (const key in vod_codec) {
|
||||
if (dashjson.codecid == key) {
|
||||
urls.push(qualityName[i] + ' ' + vod_codec[key], dashjson.baseUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (audios.length == 0) {
|
||||
for (let j = 0; j < audio.length; j++) {
|
||||
const dashjson = audio[j];
|
||||
for (const key in vod_audio_id) {
|
||||
if (dashjson.id == key) {
|
||||
audios.push({
|
||||
title: _.floor(parseInt(vod_audio_id[key]) / 1024) + 'Kbps',
|
||||
bit: vod_audio_id[key],
|
||||
url: dashjson.baseUrl,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
audios = _.sortBy(audios, 'bit');
|
||||
}
|
||||
}
|
||||
|
||||
return JSON.stringify({
|
||||
parse: 0,
|
||||
url: urls,
|
||||
extra: {
|
||||
audio: audios,
|
||||
},
|
||||
header: playHeaders,
|
||||
});
|
||||
}
|
||||
} catch (e) {}
|
||||
return null;
|
||||
}
|
||||
|
||||
async function search(key, quick, pg) {
|
||||
let page = pg || 1;
|
||||
if (page == 0) page = 1;
|
||||
try {
|
||||
const ext = {
|
||||
duration: '4',
|
||||
};
|
||||
let resp = JSON.parse(await category(key, page, true, ext));
|
||||
const catVideos = resp.list;
|
||||
const pageCount = resp.pagecount;
|
||||
const videos = [];
|
||||
for (let i = 0; i < catVideos.length; ++i) {
|
||||
videos.push(catVideos[i]);
|
||||
}
|
||||
const result = {
|
||||
page: page,
|
||||
pagecount: pageCount,
|
||||
land: 1,
|
||||
ratio: 1.78,
|
||||
list: videos,
|
||||
};
|
||||
return JSON.stringify(result);
|
||||
} catch (e) {}
|
||||
return null;
|
||||
}
|
||||
|
||||
async function proxy(segments, headers) {
|
||||
let what = segments[0];
|
||||
let url = base64Decode(segments[1]);
|
||||
if (what == 'dash') {
|
||||
const ids = url.split('+');
|
||||
const aid = ids[0];
|
||||
const cid = ids[1];
|
||||
const str5 = ids[2];
|
||||
const urls = `https://api.bilibili.com/x/player/playurl?avid=${aid}&cid=${cid}&qn=${str5}&fnval=4048&fourk=1`;
|
||||
let videoList = '';
|
||||
let audioList = '';
|
||||
|
||||
let resp = JSON.parse(await request(urls, getHeaders()));
|
||||
const dash = resp.data.dash;
|
||||
const video = dash.video;
|
||||
const audio = dash.audio;
|
||||
|
||||
for (let i = 0; i < video.length; i++) {
|
||||
// if (i > 0) continue; // 只取一个
|
||||
const dashjson = video[i];
|
||||
if (dashjson.id == str5) {
|
||||
videoList += getDashMedia(dashjson);
|
||||
}
|
||||
}
|
||||
|
||||
for (let i = 0; i < audio.length; i++) {
|
||||
// if (i > 0) continue;
|
||||
const ajson = audio[i];
|
||||
for (const key in vod_audio_id) {
|
||||
if (ajson.id == key) {
|
||||
audioList += getDashMedia(ajson);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let mpd = getDash(resp, videoList, audioList);
|
||||
return JSON.stringify({
|
||||
code: 200,
|
||||
content: mpd,
|
||||
headers: {
|
||||
'Content-Type': 'application/dash+xml',
|
||||
},
|
||||
});
|
||||
}
|
||||
return JSON.stringify({
|
||||
code: 500,
|
||||
content: '',
|
||||
});
|
||||
}
|
||||
|
||||
function getDashMedia(dash) {
|
||||
try {
|
||||
let qnid = dash.id;
|
||||
const codecid = dash.codecid;
|
||||
const media_codecs = dash.codecs;
|
||||
const media_bandwidth = dash.bandwidth;
|
||||
const media_startWithSAP = dash.startWithSap;
|
||||
const media_mimeType = dash.mimeType;
|
||||
const media_BaseURL = dash.baseUrl.replace(/&/g, '&');
|
||||
const media_SegmentBase_indexRange = dash.SegmentBase.indexRange;
|
||||
const media_SegmentBase_Initialization = dash.SegmentBase.Initialization;
|
||||
const mediaType = media_mimeType.split('/')[0];
|
||||
let media_type_params = '';
|
||||
|
||||
if (mediaType == 'video') {
|
||||
const media_frameRate = dash.frameRate;
|
||||
const media_sar = dash.sar;
|
||||
const media_width = dash.width;
|
||||
const media_height = dash.height;
|
||||
media_type_params = `height='${media_height}' width='${media_width}' frameRate='${media_frameRate}' sar='${media_sar}'`;
|
||||
} else if (mediaType == 'audio') {
|
||||
for (const key in vod_audio_id) {
|
||||
if (qnid == key) {
|
||||
const audioSamplingRate = vod_audio_id[key];
|
||||
media_type_params = `numChannels='2' sampleRate='${audioSamplingRate}'`;
|
||||
}
|
||||
}
|
||||
}
|
||||
qnid += '_' + codecid;
|
||||
|
||||
return `<AdaptationSet lang="chi">
|
||||
<ContentComponent contentType="${mediaType}"/>
|
||||
<Representation id="${qnid}" bandwidth="${media_bandwidth}" codecs="${media_codecs}" mimeType="${media_mimeType}" ${media_type_params} startWithSAP="${media_startWithSAP}">
|
||||
<BaseURL>${media_BaseURL}</BaseURL>
|
||||
<SegmentBase indexRange="${media_SegmentBase_indexRange}">
|
||||
<Initialization range="${media_SegmentBase_Initialization}"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
</AdaptationSet>`;
|
||||
} catch (e) {
|
||||
// Handle exceptions here
|
||||
}
|
||||
}
|
||||
|
||||
function getDash(ja, videoList, audioList) {
|
||||
const duration = ja.data.dash.duration;
|
||||
const minBufferTime = ja.data.dash.minBufferTime;
|
||||
return `<MPD xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:mpeg:dash:schema:mpd:2011" xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd" type="static" mediaPresentationDuration="PT${duration}S" minBufferTime="PT${minBufferTime}S" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011">
|
||||
<Period duration="PT${duration}S" start="PT0S">
|
||||
${videoList}
|
||||
${audioList}
|
||||
</Period>
|
||||
</MPD>`;
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
function removeTags(input) {
|
||||
return input.replace(/<[^>]*>/g, '');
|
||||
}
|
||||
|
||||
export function __jsEvalReturn() {
|
||||
return {
|
||||
init: init,
|
||||
home: home,
|
||||
homeVod: homeVod,
|
||||
category: category,
|
||||
detail: detail,
|
||||
play: play,
|
||||
proxy: proxy,
|
||||
search: search,
|
||||
};
|
||||
}
|
61
js/build.js
Normal file
61
js/build.js
Normal file
@ -0,0 +1,61 @@
|
||||
import fs from 'node:fs';
|
||||
import path from 'path';
|
||||
import uglifyjs from 'uglify-js';
|
||||
|
||||
const copySpider = ['app', 'kunyu77_open', 'alist_open'];
|
||||
|
||||
const root = process.cwd();
|
||||
|
||||
const src = path.join(root);
|
||||
const out = path.join(root, 'dist');
|
||||
|
||||
function minify(s, d) {
|
||||
var jsContent = fs.readFileSync(s).toString();
|
||||
jsContent = jsContent.replace('./lib/cat.js', 'assets://js/lib/cat.js');
|
||||
jsContent = jsContent.replace('./cat.js', 'assets://js/lib/cat.js');
|
||||
jsContent = uglifyjs.minify(jsContent, {
|
||||
mangle: false,
|
||||
});
|
||||
fs.writeFileSync(d, jsContent.code);
|
||||
}
|
||||
|
||||
function listAllFiles(dirPath, arrayOfFiles) {
|
||||
var files = fs.readdirSync(dirPath);
|
||||
|
||||
arrayOfFiles = arrayOfFiles || [];
|
||||
|
||||
files.forEach(function (file) {
|
||||
if (fs.statSync(dirPath + '/' + file).isDirectory()) {
|
||||
arrayOfFiles = listAllFiles(dirPath + '/' + file, arrayOfFiles);
|
||||
} else {
|
||||
arrayOfFiles.push(path.join(dirPath, '/', file));
|
||||
}
|
||||
});
|
||||
|
||||
return arrayOfFiles;
|
||||
}
|
||||
|
||||
function src2Out() {
|
||||
if (fs.existsSync(out)) fs.rmSync(out, { recursive: true, force: true });
|
||||
|
||||
fs.mkdirSync(out, { recursive: true });
|
||||
const libSrc = path.join(src, 'lib');
|
||||
const libOut = path.join(out, 'lib');
|
||||
fs.mkdirSync(libOut, { recursive: true });
|
||||
const libs = listAllFiles(libSrc);
|
||||
for (let index = 0; index < libs.length; index++) {
|
||||
const element = libs[index];
|
||||
const relative = path.relative(libSrc, element);
|
||||
minify(element, path.join(libOut, relative));
|
||||
}
|
||||
|
||||
for (const sp of copySpider) {
|
||||
minify(path.join(src, sp + '.js'), path.join(out, sp + '.js'));
|
||||
}
|
||||
}
|
||||
|
||||
src2Out();
|
||||
|
||||
fs.copyFileSync(path.join(src, 'config_open.json'), path.join(out, 'config_open.json'));
|
||||
|
||||
console.log('done');
|
161
js/config_open.json
Normal file
161
js/config_open.json
Normal file
@ -0,0 +1,161 @@
|
||||
{
|
||||
"video": {
|
||||
"sites": [
|
||||
{"key":"drpy_js_boosj_open","name":"童趣┃猫","type":3,"api":"assets://js/boosj_open.js"},
|
||||
{"key":"drpy_js_tuxiaobei_open","name":"兔小贝┃猫","type":3,"api":"assets://js/tuxiaobei_open.js"},
|
||||
{"key":"drpy_js_ubestkid_open","name":"贝乐虎┃猫","type":3,"api":"assets://js/ubestkid_open.js"},
|
||||
{"key":"drpy_js_dj0898_open","name":"世纪DJ┃猫","type":3,"api":"assets://js/dj0898_open.js"},
|
||||
{"key":"drpy_js_zxzj_open","name":"在线之家┃猫","type":3,"api":"assets://js/zxzj_open.js"},
|
||||
{"key":"drpy_js_cntv_open","name":"视聚场┃猫","type":3,"api":"assets://js/cntv_open.js"},
|
||||
{"key":"drpy_js_bili_open","name":"哔哩合集┃猫","type":3,"api":"assets://js/bili_open.js"},
|
||||
{
|
||||
"key": "wogg",
|
||||
"name": "Cat_open_js_玩偶|猫影视app",
|
||||
"type": 3,
|
||||
"api": "assets://js/wogg_open.js",
|
||||
"ext": "8069d2ca50c749ed932e171fb2a41b95"
|
||||
},
|
||||
|
||||
{
|
||||
"key": "kunyu77",
|
||||
"name": "Cat_open_js_鲲鱼|猫影视app",
|
||||
"type": 3,
|
||||
"api": "assets://js/kunyu77_open.js"
|
||||
},
|
||||
{
|
||||
"key": "czzy",
|
||||
"name": "Cat_open_js_厂长|猫影视app",
|
||||
"type": 3,
|
||||
"api": "assets://js/czzy_open.js"
|
||||
},
|
||||
{
|
||||
"key": "libvio",
|
||||
"name": "Cat_open_js_黎波|猫影视app",
|
||||
"type": 3,
|
||||
"api": "assets://js/libvio_open.js"
|
||||
},
|
||||
{
|
||||
"key": "kkys",
|
||||
"name": "Cat_open_js_快看|猫影视app",
|
||||
"type": 3,
|
||||
"api": "assets://js/kkys_open.js"
|
||||
},
|
||||
{
|
||||
"key": "ikanbot",
|
||||
"name": "Cat_open_js_爱看|猫影视app",
|
||||
"type": 3,
|
||||
"api": "assets://js/ikanbot_open.js"
|
||||
},
|
||||
{
|
||||
"key": "ngys",
|
||||
"name": "Cat_open_js_南瓜|猫影视app",
|
||||
"type": 3,
|
||||
"api": "assets://js/ng_open.js"
|
||||
},
|
||||
{
|
||||
"key": "duboku",
|
||||
"name": "Cat_open_js_独播库|猫影视app",
|
||||
"type": 3,
|
||||
"api": "assets://js/duboku_open.js"
|
||||
},
|
||||
{
|
||||
"key": "subaibai",
|
||||
"name": "Cat_open_js_素白白|猫影视app",
|
||||
"type": 3,
|
||||
"api": "assets://js/subaibai_open.js"
|
||||
},
|
||||
|
||||
{
|
||||
"key": "sharenice",
|
||||
"name": "Cat_open_js_短视频|猫影视app",
|
||||
"type": 3,
|
||||
"api": "assets://js/sharenice_open.js"
|
||||
},
|
||||
{
|
||||
"key": "mybili",
|
||||
"name": "Cat_open_js_哔哩|猫影视app",
|
||||
"type": 3,
|
||||
"api": "assets://js/mybili_open.js"
|
||||
},
|
||||
{
|
||||
"key": "kuqimv",
|
||||
"name": "Cat_open_js_酷奇|猫影视app",
|
||||
"type": 3,
|
||||
"api": "assets://js/kuqimv_open.js"
|
||||
},
|
||||
{
|
||||
"key": "230ts",
|
||||
"name": "Cat_open_js_听书|猫影视app",
|
||||
"type": 3,
|
||||
"api": "assets://js/230ts_open.js"
|
||||
}
|
||||
|
||||
]
|
||||
},
|
||||
"pan": {
|
||||
"sites": [
|
||||
{
|
||||
"key": "alist",
|
||||
"name": "Alist",
|
||||
"type": 40,
|
||||
"api": "assets://js/alist_open.js",
|
||||
"ext": [
|
||||
{
|
||||
"name": "🙋丫仙女",
|
||||
"server": "http://alist.xiaoya.pro/",
|
||||
"startPage": "/",
|
||||
"showAll": false,
|
||||
"search": true,
|
||||
"headers": {
|
||||
"Authorization": ""
|
||||
},
|
||||
"params": {
|
||||
"/abc": {
|
||||
"password": "123"
|
||||
},
|
||||
"/abc/abc": {
|
||||
"password": "123"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "🐋一只鱼",
|
||||
"server": "https://alist.youte.ml"
|
||||
},
|
||||
{
|
||||
"name": "杜比",
|
||||
"server": "https://dubi.tk"
|
||||
},
|
||||
{
|
||||
"name": "资源",
|
||||
"server": "https://pan.ecve.cn"
|
||||
},
|
||||
{
|
||||
"name": "🌊七米蓝",
|
||||
"server": "https://al.chirmyram.com"
|
||||
},
|
||||
{
|
||||
"name": "🐉神族九帝",
|
||||
"server": "https://alist.shenzjd.com"
|
||||
},
|
||||
{
|
||||
"name": "☃️姬路白雪",
|
||||
"server": "https://pan.jlbx.xyz"
|
||||
},
|
||||
{
|
||||
"name": "✨星梦",
|
||||
"server": "https://pan.bashroot.top"
|
||||
},
|
||||
{
|
||||
"name": "💢repl",
|
||||
"server": "https://ali.liucn.repl.co"
|
||||
},
|
||||
{
|
||||
"name": "💦讯维云盘",
|
||||
"server": "https://pan.xwbeta.com"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
244
js/czzy_open.js
Normal file
244
js/czzy_open.js
Normal file
@ -0,0 +1,244 @@
|
||||
// 自动从 地址发布页 获取&跳转url地址
|
||||
import { Crypto, load, _ } from './lib/cat.js';
|
||||
|
||||
let key = 'czzy';
|
||||
let host = 'https://www.czzy.site'; // 厂长地址发布页
|
||||
// let url = 'https://cz01.cc';
|
||||
let url = '';
|
||||
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';
|
||||
const cookie = {};
|
||||
|
||||
async function request(reqUrl, referer, mth, data, hd) {
|
||||
const headers = {
|
||||
'User-Agent': UA,
|
||||
Cookie: _.map(cookie, (value, key) => {
|
||||
return `${key}=${value}`;
|
||||
}).join(';'),
|
||||
};
|
||||
if (referer) headers.referer = encodeURIComponent(referer);
|
||||
let res = await req(reqUrl, {
|
||||
method: mth || 'get',
|
||||
headers: headers,
|
||||
data: data,
|
||||
postType: mth === 'post' ? 'form' : '',
|
||||
});
|
||||
if (res.headers['set-cookie']) {
|
||||
const set_cookie = _.isArray(res.headers['set-cookie']) ? res.headers['set-cookie'].join(';') : res.headers['set-cookie'];
|
||||
const cks = set_cookie.split(';');
|
||||
for (const c of cks) {
|
||||
const tmp = c.trim();
|
||||
if (tmp.startsWith('result=')) {
|
||||
cookie.result = tmp.substring(7);
|
||||
return await request(reqUrl, reqUrl, 'post', {
|
||||
result: cookie.result,
|
||||
});
|
||||
} else if (tmp.startsWith('esc_search_captcha=1')) {
|
||||
cookie.esc_search_captcha = 1;
|
||||
delete cookie.result;
|
||||
return await request(reqUrl);
|
||||
}
|
||||
}
|
||||
// console.log(res.headers['set-cookie']);
|
||||
}
|
||||
return res.content;
|
||||
}
|
||||
|
||||
// cfg = {skey: siteKey, ext: extend}
|
||||
async function init(cfg) {
|
||||
siteKey = cfg.skey;
|
||||
siteType = cfg.stype;
|
||||
let html = await request(host);
|
||||
url = html.match(/推荐访问<a href="(.*)"/)[1];
|
||||
console.debug('厂长跳转地址 =====>' + url); // js_debug.log
|
||||
}
|
||||
|
||||
async function home(filter) {
|
||||
let filterObj = {};
|
||||
const html = await request(url + '/movie_bt');
|
||||
const $ = load(html);
|
||||
const tags = $('div#beautiful-taxonomy-filters-tax-movie_bt_tags > a');
|
||||
let tag = {
|
||||
key: 'tag',
|
||||
name: '类型',
|
||||
value: _.map(tags, (n) => {
|
||||
let v = n.attribs['cat-url'] || '';
|
||||
v = v.substring(v.lastIndexOf('/') + 1);
|
||||
return { n: n.children[0].data, v: v };
|
||||
}),
|
||||
};
|
||||
tag['init'] = tag.value[0].v;
|
||||
const series = $('div#beautiful-taxonomy-filters-tax-movie_bt_series > a[cat-url*=movie_bt_series]');
|
||||
let classes = _.map(series, (s) => {
|
||||
let typeId = s.attribs['cat-url'];
|
||||
typeId = typeId.substring(typeId.lastIndexOf('/') + 1);
|
||||
filterObj[typeId] = [tag];
|
||||
return {
|
||||
type_id: typeId,
|
||||
type_name: s.children[0].data,
|
||||
};
|
||||
});
|
||||
const sortName = ['电影', '电视剧', '国产剧', '美剧', '韩剧', '日剧', '海外剧(其他)', '华语电影', '印度电影', '日本电影', '欧美电影', '韩国电影', '动画', '俄罗斯电影', '加拿大电影'];
|
||||
classes = _.sortBy(classes, (c) => {
|
||||
const index = sortName.indexOf(c.type_name);
|
||||
return index === -1 ? sortName.length : index;
|
||||
});
|
||||
return JSON.stringify({
|
||||
class: classes,
|
||||
filters: filterObj,
|
||||
});
|
||||
}
|
||||
|
||||
async function homeVod() {
|
||||
return '{}';
|
||||
}
|
||||
|
||||
async function category(tid, pg, filter, extend) {
|
||||
if (pg <= 0) pg = 1;
|
||||
const tag = extend.tag || '';
|
||||
const link = url + '/movie_bt' + (tag.length > 0 ? `/movie_bt_tags/${tag}` : '') + '/movie_bt_series/' + tid + (pg > 1 ? `/page/${pg}` : '');
|
||||
const html = await request(link);
|
||||
const $ = load(html);
|
||||
const items = $('div.mrb > ul > li');
|
||||
let videos = _.map(items, (item) => {
|
||||
const img = $(item).find('img:first')[0];
|
||||
const a = $(item).find('a:first')[0];
|
||||
const hdinfo = $($(item).find('div.hdinfo')[0]).text().trim();
|
||||
const jidi = $($(item).find('div.jidi')[0]).text().trim();
|
||||
return {
|
||||
vod_id: a.attribs.href.replace(/.*?\/movie\/(.*).html/g, '$1'),
|
||||
vod_name: img.attribs.alt,
|
||||
vod_pic: img.attribs['data-original'],
|
||||
vod_remarks: jidi || hdinfo || '',
|
||||
};
|
||||
});
|
||||
const hasMore = $('div.mrb > div.pagenavi_txt > a:contains(>)').length > 0;
|
||||
const pgCount = hasMore ? parseInt(pg) + 1 : parseInt(pg);
|
||||
return JSON.stringify({
|
||||
page: parseInt(pg),
|
||||
pagecount: pgCount,
|
||||
limit: 20,
|
||||
total: 20 * pgCount,
|
||||
list: videos,
|
||||
});
|
||||
}
|
||||
|
||||
function stripHtmlTag(src) {
|
||||
return src
|
||||
.replace(/<\/?[^>]+(>|$)/g, '')
|
||||
.replace(/&.{1,5};/g, '')
|
||||
.replace(/\s{2,}/g, ' ');
|
||||
}
|
||||
|
||||
async function detail(id) {
|
||||
const html = await request(url + '/movie/' + id + '.html');
|
||||
const $ = load(html);
|
||||
const detail = $('ul.moviedteail_list > li');
|
||||
let vod = {
|
||||
vod_id: id,
|
||||
vod_pic: $('div.dyimg img:first').attr('src'),
|
||||
vod_remarks: '',
|
||||
vod_content: stripHtmlTag($('div.yp_context').html()).trim(),
|
||||
};
|
||||
for (const info of detail) {
|
||||
const i = $(info).text().trim();
|
||||
if (i.startsWith('地区:')) {
|
||||
vod.vod_area = i.substring(3);
|
||||
} else if (i.startsWith('年份:')) {
|
||||
vod.vod_year = i.substring(3);
|
||||
} else if (i.startsWith('导演:')) {
|
||||
vod.vod_director = _.map($(info).find('a'), (a) => {
|
||||
return a.children[0].data;
|
||||
}).join('/');
|
||||
} else if (i.startsWith('主演:')) {
|
||||
vod.vod_actor = _.map($(info).find('a'), (a) => {
|
||||
return a.children[0].data;
|
||||
}).join('/');
|
||||
} else if (i.startsWith('语言:')) {
|
||||
vod.vod_lang = i.substring(3);
|
||||
}
|
||||
}
|
||||
const playlist = _.map($('div.paly_list_btn > a'), (a) => {
|
||||
return a.children[0].data + '$' + a.attribs.href.replace(/.*?\/v_play\/(.*).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 + '/v_play/' + id + '.html';
|
||||
const html = await request(link);
|
||||
const $ = load(html);
|
||||
const iframe = $('body iframe[src*=Cloud]');
|
||||
if (iframe.length > 0) {
|
||||
const iframeHtml = (
|
||||
await req(iframe[0].attribs.src, {
|
||||
headers: {
|
||||
Referer: link,
|
||||
'User-Agent': UA,
|
||||
},
|
||||
})
|
||||
).content;
|
||||
let code = iframeHtml
|
||||
.match(/var url = '(.*?)'/)[1]
|
||||
.split('')
|
||||
.reverse()
|
||||
.join('');
|
||||
let temp = '';
|
||||
for (let i = 0x0; i < code.length; i = i + 0x2) {
|
||||
temp += String.fromCharCode(parseInt(code[i] + code[i + 0x1], 0x10));
|
||||
}
|
||||
const playUrl = temp.substring(0x0, (temp.length - 0x7) / 0x2) + temp.substring((temp.length - 0x7) / 0x2 + 0x7);
|
||||
return JSON.stringify({
|
||||
parse: 0,
|
||||
url: playUrl,
|
||||
});
|
||||
} else {
|
||||
const js = $('script:contains(window.wp_nonce)').html();
|
||||
const group = js.match(/(var.*)eval\((\w*\(\w*\))\)/);
|
||||
const md5 = Crypto;
|
||||
const result = eval(group[1] + group[2]);
|
||||
const playUrl = result.match(/url:.*?['"](.*?)['"]/)[1];
|
||||
return JSON.stringify({
|
||||
parse: 0,
|
||||
url: playUrl,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async function search(wd, quick) {
|
||||
const html = await request(url + '/?s=' + wd);
|
||||
const $ = load(html);
|
||||
const items = $('div.search_list > ul > li');
|
||||
let videos = _.map(items, (item) => {
|
||||
const img = $(item).find('img:first')[0];
|
||||
const a = $(item).find('a:first')[0];
|
||||
const hdinfo = $($(item).find('div.hdinfo')[0]).text().trim();
|
||||
const jidi = $($(item).find('div.jidi')[0]).text().trim();
|
||||
return {
|
||||
vod_id: a.attribs.href.replace(/.*?\/movie\/(.*).html/g, '$1'),
|
||||
vod_name: img.attribs.alt,
|
||||
vod_pic: img.attribs['data-original'],
|
||||
vod_remarks: jidi || hdinfo || '',
|
||||
};
|
||||
});
|
||||
return JSON.stringify({
|
||||
list: videos,
|
||||
});
|
||||
}
|
||||
|
||||
export function __jsEvalReturn() {
|
||||
return {
|
||||
init: init,
|
||||
home: home,
|
||||
homeVod: homeVod,
|
||||
category: category,
|
||||
detail: detail,
|
||||
play: play,
|
||||
search: search,
|
||||
};
|
||||
}
|
166
js/duboku_open.js
Normal file
166
js/duboku_open.js
Normal file
@ -0,0 +1,166 @@
|
||||
import { Crypto, load, _, jinja2 } from './lib/cat.js';
|
||||
|
||||
let key = 'duboku';
|
||||
let url = 'https://www.duboku.tv';
|
||||
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,
|
||||
};
|
||||
}
|
261
js/ikanbot_open.js
Normal file
261
js/ikanbot_open.js
Normal file
@ -0,0 +1,261 @@
|
||||
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,
|
||||
'referer': url
|
||||
},
|
||||
});
|
||||
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() {
|
||||
const html = await request(url);
|
||||
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: '',
|
||||
};
|
||||
});
|
||||
return JSON.stringify({
|
||||
list: videos,
|
||||
});
|
||||
}
|
||||
|
||||
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');
|
||||
const remarks = $('span#line-tips').text();
|
||||
let vod = {
|
||||
vod_id: id,
|
||||
vod_pic: jsBase + base64Encode($('div.item-root > img')[0].attribs['data-src']),
|
||||
vod_remarks: '',
|
||||
vod_content: remarks || '',
|
||||
vod_name: $(detail).find('h2').text().trim(),
|
||||
vod_year: $(detail).find('h3:nth-child(3)').text(),
|
||||
vod_area: $(detail).find('h3:nth-child(4)').text(),
|
||||
vod_actor: $(detail).find('h3:nth-child(5)').text(),
|
||||
};
|
||||
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 = {};
|
||||
let arr = []
|
||||
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;
|
||||
}
|
||||
}
|
||||
for (var key in playlist) {
|
||||
if ('kuaikan' == key) {
|
||||
arr.push({
|
||||
flag: '快看',
|
||||
url: playlist[key],
|
||||
sort: 1
|
||||
})
|
||||
} else if ('bfzym3u8' == key) {
|
||||
arr.push({
|
||||
flag: '暴风',
|
||||
url: playlist[key],
|
||||
sort: 2
|
||||
})
|
||||
} else if ('ffm3u8' == key) {
|
||||
arr.push({
|
||||
flag: '非凡',
|
||||
url: playlist[key],
|
||||
sort: 3
|
||||
})
|
||||
} else if ('lzm3u8' == key) {
|
||||
arr.push({
|
||||
flag: '量子',
|
||||
url: playlist[key],
|
||||
sort: 4
|
||||
})
|
||||
} else {
|
||||
arr.push({
|
||||
flag: key,
|
||||
url: playlist[key],
|
||||
sort: 5
|
||||
})
|
||||
}
|
||||
}
|
||||
arr.sort((a, b) => a.sort - b.sort);
|
||||
let playFrom = [];
|
||||
let playList = [];
|
||||
arr.map(val => {
|
||||
playFrom.push(val.flag);
|
||||
playList.push(val.url);
|
||||
})
|
||||
vod.vod_play_from = playFrom.join("$$$");
|
||||
vod.vod_play_url = 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, pg) {
|
||||
if (pg <= 0 || typeof(pg) == 'undefined') pg = 1;
|
||||
const html = await request(url + '/search?q=' + wd + '&p=' + pg);
|
||||
const $ = load(html);
|
||||
const items = $('div.media');
|
||||
var jsBase = await js2Proxy(true, siteType, siteKey, 'img/', {});
|
||||
let videos = _.map(items, (item) => {
|
||||
const a = $(item).find('a:first')[0];
|
||||
const img = $(item).find('img:first')[0];
|
||||
const remarks = $($(item).find('span.label')[0]).text().trim();
|
||||
return {
|
||||
vod_id: a.attribs.href,
|
||||
vod_name: img.attribs.alt,
|
||||
vod_pic: jsBase + base64Encode(img.attribs['data-src']),
|
||||
vod_remarks: 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,
|
||||
list: videos,
|
||||
});
|
||||
}
|
||||
|
||||
export function __jsEvalReturn() {
|
||||
return {
|
||||
init: init,
|
||||
home: home,
|
||||
homeVod: homeVod,
|
||||
category: category,
|
||||
detail: detail,
|
||||
play: play,
|
||||
proxy: proxy,
|
||||
search: search,
|
||||
};
|
||||
}
|
364
js/kkys_open.js
Normal file
364
js/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,
|
||||
};
|
||||
}
|
346
js/kunyu77_open.js
Normal file
346
js/kunyu77_open.js
Normal file
@ -0,0 +1,346 @@
|
||||
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, pg) {
|
||||
let page = pg || 1;
|
||||
if (page == 0) page = 1;
|
||||
let data = JSON.parse(await request(url + '/api.php/provide/searchVideo?searchName=' + wd + '&pg=' + page, 'okhttp/3.12.0'));
|
||||
let videos = [];
|
||||
for (const vod of data.data) {
|
||||
videos.push({
|
||||
vod_id: vod.id,
|
||||
vod_name: vod.videoName,
|
||||
vod_pic: vod.videoCover,
|
||||
vod_remarks: vod.msg,
|
||||
});
|
||||
}
|
||||
return JSON.stringify({
|
||||
page: page,
|
||||
pagecount: data.pages,
|
||||
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,
|
||||
};
|
||||
}
|
195
js/libvio_open.js
Normal file
195
js/libvio_open.js
Normal file
@ -0,0 +1,195 @@
|
||||
// 自动从 地址发布页 获取&跳转url地址
|
||||
import { load, _ } from './lib/cat.js';
|
||||
|
||||
var key = 'libvio';
|
||||
var HOST = 'https://libvio.app'; // 地址发布页
|
||||
var host = '';
|
||||
var siteKey = '';
|
||||
var siteType = 0;
|
||||
|
||||
const MOBILE_UA = 'Mozilla/5.0 (Linux; Android 11; M2007J3SC Build/RKQ1.200826.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045714 Mobile Safari/537.36';
|
||||
|
||||
async function request(reqUrl, agentSp) {
|
||||
var res = await req(reqUrl, {
|
||||
method: 'get',
|
||||
headers: {
|
||||
'User-Agent': agentSp || MOBILE_UA,
|
||||
'Referer': host
|
||||
},
|
||||
});
|
||||
return res.content;
|
||||
}
|
||||
|
||||
// cfg = {skey: siteKey, ext: extend}
|
||||
async function init(cfg) {
|
||||
siteKey = cfg.skey;
|
||||
siteType = cfg.stype;
|
||||
var html = await request(HOST);
|
||||
var $ = load(html);
|
||||
host = $('div.content-top > ul > li').find('a:first')[0].attribs.href;
|
||||
// console.debug('libvio跳转地址 =====>' + urls); // js_debug.log
|
||||
}
|
||||
|
||||
async function home(filter) {
|
||||
var html = await request(host);
|
||||
var $ = load(html);
|
||||
var class_parse = $('ul.stui-header__menu > li > a[href*=type]');
|
||||
var classes = [];
|
||||
classes = _.map(class_parse, (cls) => {
|
||||
var typeId = cls.attribs['href'];
|
||||
typeId = typeId.substring(typeId.lastIndexOf('/') + 1).replace('.html','');
|
||||
return {
|
||||
type_id: typeId,
|
||||
type_name: cls.children[0].data,
|
||||
};
|
||||
});
|
||||
var filterObj = {
|
||||
1:[{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:'印度'},{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'},{n:'2016',v:'2016'},{n:'2015',v:'2015'},{n:'2014',v:'2014'},{n:'2013',v:'2013'},{n:'2012',v:'2012'},{n:'2011',v:'2011'},{n:'2010',v:'2010'}]},{key:'lang',name:'语言',value:[{n:'全部',v:''},{n:'国语',v:'国语'},{n:'英语',v:'英语'},{n:'粤语',v:'粤语'},{n:'闽南语',v:'闽南语'},{n:'韩语',v:'韩语'},{n:'日语',v:'日语'},{n:'法语',v:'法语'},{n:'德语',v:'德语'},{n:'其它',v:'其它'}]},{key:'by',name:'排序',value:[{n:'时间',v:'time'},{n:'人气',v:'hits'},{n:'评分',v:'score'}]}],
|
||||
2:[{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:'其他'}]},{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'},{n:'2016',v:'2016'},{n:'2015',v:'2015'},{n:'2014',v:'2014'},{n:'2013',v:'2013'},{n:'2012',v:'2012'},{n:'2011',v:'2011'},{n:'2010',v:'2010'}]},{key:'lang',name:'语言',value:[{n:'全部',v:''},{n:'国语',v:'国语'},{n:'英语',v:'英语'},{n:'粤语',v:'粤语'},{n:'闽南语',v:'闽南语'},{n:'韩语',v:'韩语'},{n:'日语',v:'日语'},{n:'其它',v:'其它'}]},{key:'by',name:'排序',value:[{n:'时间',v:'time'},{n:'人气',v:'hits'},{n:'评分',v:'score'}]}],
|
||||
4:[{key:'area',name:'地区',value:[{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'},{n:'2016',v:'2016'},{n:'2015',v:'2015'},{n:'2014',v:'2014'},{n:'2013',v:'2013'},{n:'2012',v:'2012'},{n:'2011',v:'2011'},{n:'2010',v:'2010'},{n:'2009',v:'2009'},{n:'2008',v:'2008'},{n:'2007',v:'2007'},{n:'2006',v:'2006'},{n:'2005',v:'2005'},{n:'2004',v:'2004'}]},{key:'lang',name:'语言',value:[{n:'全部',v:''},{n:'国语',v:'国语'},{n:'英语',v:'英语'},{n:'粤语',v:'粤语'},{n:'闽南语',v:'闽南语'},{n:'韩语',v:'韩语'},{n:'日语',v:'日语'},{n:'其它',v:'其它'}]},{key:'by',name:'排序',value:[{n:'时间',v:'time'},{n:'人气',v:'hits'},{n:'评分',v:'score'}]}],
|
||||
27:[{key:'by',name:'排序',value:[{n:'时间',v:'time'},{n:'人气',v:'hits'},{n:'评分',v:'score'}]}],
|
||||
15:[{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'},{n:'2016',v:'2016'},{n:'2015',v:'2015'},{n:'2014',v:'2014'},{n:'2013',v:'2013'},{n:'2012',v:'2012'},{n:'2011',v:'2011'},{n:'2010',v:'2010'}]},{key:'lang',name:'语言',value:[{n:'全部',v:''},{n:'国语',v:'国语'},{n:'英语',v:'英语'},{n:'粤语',v:'粤语'},{n:'闽南语',v:'闽南语'},{n:'韩语',v:'韩语'},{n:'日语',v:'日语'},{n:'其它',v:'其它'}]},{key:'by',name:'排序',value:[{n:'时间',v:'time'},{n:'人气',v:'hits'},{n:'评分',v:'score'}]}],
|
||||
16:[{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'},{n:'2016',v:'2016'},{n:'2015',v:'2015'},{n:'2014',v:'2014'},{n:'2013',v:'2013'},{n:'2012',v:'2012'},{n:'2011',v:'2011'},{n:'2010',v:'2010'}]},{key:'lang',name:'语言',value:[{n:'全部',v:''},{n:'国语',v:'国语'},{n:'英语',v:'英语'},{n:'粤语',v:'粤语'},{n:'闽南语',v:'闽南语'},{n:'韩语',v:'韩语'},{n:'日语',v:'日语'},{n:'其它',v:'其它'}]},{key:'by',name:'排序',value:[{n:'时间',v:'time'},{n:'人气',v:'hits'},{n:'评分',v:'score'}]}]
|
||||
};
|
||||
return JSON.stringify({
|
||||
class: classes,
|
||||
filters: filterObj,
|
||||
});
|
||||
}
|
||||
|
||||
async function homeVod() {
|
||||
var link = host + '/show/1--hits---------.html';
|
||||
var html = await request(link);
|
||||
var $ = load(html);
|
||||
var items = $('ul.stui-vodlist > li');
|
||||
let videos = _.map(items, (item) => {
|
||||
var a = $(item).find('a:first')[0];
|
||||
var remarks = $($(item).find('span.pic-text')[0]).text().trim();
|
||||
return {
|
||||
vod_id: a.attribs.href.replace(/.*?\/detail\/(.*).html/g, '$1'),
|
||||
vod_name: a.attribs.title,
|
||||
vod_pic: a.attribs['data-original'],
|
||||
vod_remarks: remarks || '',
|
||||
};
|
||||
});
|
||||
return JSON.stringify({
|
||||
list: videos,
|
||||
});
|
||||
}
|
||||
|
||||
async function category(tid, pg, filter, extend) {
|
||||
if (pg <= 0 || typeof(pg) == 'undefined') pg = 1;
|
||||
var link = host + '/show/' + tid + '-' + (extend.area || '') + '-' + (extend.by || 'time') + '--' + (extend.lang || '') + '----' + pg + '---' + (extend.year || '') + '.html';
|
||||
var html = await request(link);
|
||||
var $ = load(html);
|
||||
var items = $('ul.stui-vodlist > li');
|
||||
let videos = _.map(items, (item) => {
|
||||
var a = $(item).find('a:first')[0];
|
||||
var remarks = $($(item).find('span.pic-text')[0]).text().trim();
|
||||
return {
|
||||
vod_id: a.attribs.href.replace(/.*?\/detail\/(.*).html/g, '$1'),
|
||||
vod_name: a.attribs.title,
|
||||
vod_pic: a.attribs['data-original'],
|
||||
vod_remarks: remarks || '',
|
||||
};
|
||||
});
|
||||
var hasMore = $('ul.stui-page__item > li > a:contains(下一页)').length > 0;
|
||||
var 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) {
|
||||
var html = await request(host + '/detail/' + id + '.html');
|
||||
var $ = load(html);
|
||||
var vod = {
|
||||
vod_id: id,
|
||||
vod_name: $('h1:first').text().trim(),
|
||||
vod_type: $('.stui-content__detail p:first a').text(),
|
||||
vod_actor: $('.stui-content__detail p:nth-child(3)').text().replace('主演:',''),
|
||||
vod_pic: $('.stui-content__thumb img:first').attr('data-original'),
|
||||
vod_remarks : $('.stui-content__detail p:nth-child(5)').text() || '',
|
||||
vod_content: $('span.detail-content').text().trim(),
|
||||
};
|
||||
var playMap = {};
|
||||
var tabs = $('div.stui-pannel__head > h3[class*=iconfont]');
|
||||
var playlists = $('ul.stui-content__playlist');
|
||||
_.each(tabs, (tab, i) => {
|
||||
var from = tab.children[0].data;
|
||||
var list = playlists[i];
|
||||
list = $(list).find('a');
|
||||
_.each(list, (it) => {
|
||||
var title = it.children[0].data;
|
||||
var playUrl = it.attribs.href;
|
||||
if (title.length == 0) title = it.children[0].data.trim();
|
||||
if (!playMap.hasOwnProperty(from)) {
|
||||
playMap[from] = [];
|
||||
}
|
||||
playMap[from].push( title + '$' + playUrl);
|
||||
});
|
||||
});
|
||||
vod.vod_play_from = _.keys(playMap).join('$$$');
|
||||
var urls = _.values(playMap);
|
||||
var vod_play_url = _.map(urls, (urlist) => {
|
||||
return urlist.join('#');
|
||||
});
|
||||
vod.vod_play_url = vod_play_url.join('$$$');
|
||||
return JSON.stringify({
|
||||
list: [vod],
|
||||
});
|
||||
}
|
||||
|
||||
async function play(flag, id, flags) {
|
||||
var html = await request(host + id);
|
||||
html = html.match(/r player_.*?=(.*?)</)[1];
|
||||
var js = JSON.parse(html);
|
||||
var url = js.url;
|
||||
var from = js.from;
|
||||
var next = js.link_next;
|
||||
var id = js.id;
|
||||
var nid = js.nid;
|
||||
var paurl = await request(host +'/static/player/' + from + '.js');
|
||||
paurl = paurl.match(/ src="(.*?)'/)[1];
|
||||
var purl = paurl + url + '&next=' + next + '&id=' + id + '&nid=' + nid;
|
||||
var playUrl = await request(purl);
|
||||
playUrl = playUrl.match(/var .* = '(.*?)'/)[1];
|
||||
// console.debug('libvio playUrl =====>' + playUrl); // js_debug.log
|
||||
return JSON.stringify({
|
||||
parse: 0,
|
||||
url: playUrl,
|
||||
});
|
||||
}
|
||||
|
||||
async function search(wd, quick) {
|
||||
var data = JSON.parse(await request(host + '/index.php/ajax/suggest?mid=1&wd=' + wd + '&limit=50')).list;
|
||||
var 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,
|
||||
limit: 50,
|
||||
});
|
||||
}
|
||||
|
||||
export function __jsEvalReturn() {
|
||||
return {
|
||||
init: init,
|
||||
home: home,
|
||||
homeVod: homeVod,
|
||||
category: category,
|
||||
detail: detail,
|
||||
play: play,
|
||||
search: search,
|
||||
};
|
||||
}
|
265
js/mybili_open.js
Normal file
265
js/mybili_open.js
Normal file
File diff suppressed because one or more lines are too long
213
js/ng_open.js
Normal file
213
js/ng_open.js
Normal file
@ -0,0 +1,213 @@
|
||||
import { Crypto, jinja2, _ } from './lib/cat.js';
|
||||
|
||||
let key = '南瓜影视';
|
||||
let HOST = 'http://ys.changmengyun.com';
|
||||
let siteKey = '';
|
||||
let siteType = 0;
|
||||
let MOBILE_UA = 'okhttp/4.6.0'
|
||||
|
||||
async function request(reqUrl) {
|
||||
let t = new Date().getTime().toString();
|
||||
let res = await req(reqUrl, {
|
||||
method: 'get',
|
||||
headers: {
|
||||
'version_name': '1.0.6',
|
||||
'version_code': '6',
|
||||
'package_name': 'com.app.nanguatv',
|
||||
'sign': Crypto.MD5('c431ea542cee9679#uBFszdEM0oL0JRn@' + t).toString().toLowerCase(),
|
||||
'imei': 'c431ea542cee9679',
|
||||
'timeMillis': t,
|
||||
'User-Agent': MOBILE_UA
|
||||
},
|
||||
});
|
||||
return res.content;
|
||||
}
|
||||
|
||||
async function init(cfg) {
|
||||
siteKey = cfg.skey;
|
||||
siteType = cfg.stype;
|
||||
}
|
||||
|
||||
async function home(filter) {
|
||||
let data = JSON.parse(await request(HOST + '/api.php/provide/home_nav'));
|
||||
let classes = [];
|
||||
for (const key in data) {
|
||||
if (data[key].name != '精选')
|
||||
classes.push({
|
||||
type_id: data[key].id,
|
||||
type_name: data[key].name,
|
||||
});
|
||||
}
|
||||
let filterObj = {
|
||||
"2":[{"key":"class","name":"类型","value":[{"n":"全部","v":"类型"},{"n":"国产剧","v":"国产剧"},{"n":"港台剧","v":"港台剧"}]},{"key":"area","name":"地区","value":[{"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"},{"n":"2016","v":"2016"},{"n":"2015","v":"2015"},{"n":"10年代","v":"10年代"},{"n":"00年代","v":"00年代"},{"n":"90年代","v":"90年代"},{"n":"80年代","v":"80年代"}]},{"key":"by","name":"排序","value":[{"n":"热播榜","v":"热播榜"},{"n":"好评榜","v":"好评榜"},{"n":"新上线","v":"新上线"}]}],
|
||||
"1":[{"key":"class","name":"类型","value":[{"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":"韩国"},{"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"},{"n":"2016","v":"2016"},{"n":"2015","v":"2015"},{"n":"10年代","v":"10年代"},{"n":"00年代","v":"00年代"},{"n":"90年代","v":"90年代"},{"n":"80年代","v":"80年代"}]},{"key":"by","name":"排序","value":[{"n":"热播榜","v":"热播榜"},{"n":"好评榜","v":"好评榜"},{"n":"新上线","v":"新上线"}]}],
|
||||
"4":[{"key":"class","name":"类型","value":[{"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"},{"n":"2016","v":"2016"},{"n":"2015","v":"2015"},{"n":"10年代","v":"10年代"},{"n":"00年代","v":"00年代"},{"n":"90年代","v":"90年代"},{"n":"80年代","v":"80年代"}]},{"key":"by","name":"排序","value":[{"n":"热播榜","v":"热播榜"},{"n":"新上线","v":"新上线"}]},{"key":"total","name":"状态","value":[{"n":"全部","v":"状态"},{"n":"连载","v":"连载"},{"n":"完结","v":"完结"}]}],
|
||||
"3":[{"key":"class","name":"类型","value":[{"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"},{"n":"2016","v":"2016"},{"n":"2015","v":"2015"},{"n":"10年代","v":"10年代"},{"n":"00年代","v":"00年代"},{"n":"90年代","v":"90年代"},{"n":"80年代","v":"80年代"}]},{"key":"by","name":"排序","value":[{"n":"热播榜","v":"热播榜"},{"n":"新上线","v":"新上线"}]}],
|
||||
"46":[{"key":"class","name":"类型","value":[{"n":"全部","v":"类型"},{"n":"日韩剧","v":"日韩剧"},{"n":"欧美剧","v":"欧美剧"},{"n":"海外剧","v":"海外剧"}]},{"key":"area","name":"地区","value":[{"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"},{"n":"2016","v":"2016"},{"n":"2015","v":"2015"},{"n":"10年代","v":"10年代"},{"n":"00年代","v":"00年代"},{"n":"90年代","v":"90年代"},{"n":"80年代","v":"80年代"}]},{"key":"by","name":"排序","value":[{"n":"热播榜","v":"热播榜"},{"n":"好评榜","v":"好评榜"},{"n":"新上线","v":"新上线"}]}]
|
||||
};
|
||||
return JSON.stringify({
|
||||
class: classes,
|
||||
filters: filterObj,
|
||||
});
|
||||
}
|
||||
|
||||
async function homeVod() {
|
||||
let data = JSON.parse(await request(HOST + '/api.php/provide/vod_rank?app=ylys&sort_type=month&imei=c431ea542cee9679&id=2&page=1'));
|
||||
let videos = [];
|
||||
data.forEach(function(it) {
|
||||
videos.push({
|
||||
vod_id: it.id,
|
||||
vod_name: it.name,
|
||||
vod_pic: it.img,
|
||||
vod_remarks: it.remarks,
|
||||
});
|
||||
});
|
||||
return JSON.stringify({
|
||||
list: videos,
|
||||
});
|
||||
}
|
||||
|
||||
async function category(tid, pg, filter, extend) {
|
||||
if (pg <= 0 || typeof(pg) == 'undefined') pg = 1;
|
||||
let reqUrl = HOST + '/api.php/provide/vod_list?app=ylys&id=' + tid + '&page=' + pg + '&imei=c431ea542cee9679&';
|
||||
reqUrl += jinja2('area={{ext.area}}&year={{ext.year}}&type={{ext.class}}&total={{ext.total}}&order={{ext.by}}', { ext: extend });
|
||||
// let data = JSON.parse(await request(reqUrl));
|
||||
let data = JSON.parse(await request(reqUrl)).list;
|
||||
let videos = [];
|
||||
data.forEach(function(it) {
|
||||
videos.push({
|
||||
vod_id: it.id,
|
||||
vod_name: it.name,
|
||||
vod_pic: it.img,
|
||||
vod_remarks: it.remarks,
|
||||
});
|
||||
});
|
||||
let pgChk = JSON.parse(await request(HOST + '/api.php/provide/vod_list?app=ylys&id=' + tid + '&page=' + (parseInt(pg) + 1) + '&imei=c431ea542cee9679&')).msg;
|
||||
const pgCount = (pgChk == 'ok') ? parseInt(pg) + 1 : parseInt(pg);
|
||||
return JSON.stringify({
|
||||
page: parseInt(pg),
|
||||
pagecount: pgCount,
|
||||
limit: 20,
|
||||
total: 20 * pgCount,
|
||||
list: videos,
|
||||
});
|
||||
}
|
||||
|
||||
async function detail(id) {
|
||||
let data = JSON.parse(await request(HOST + '/api.php/provide/vod_detail?app=ylys&imei=c431ea542cee9679&id=' + id)).data;
|
||||
let vod = {
|
||||
vod_id: data.id,
|
||||
vod_name: data.name,
|
||||
vod_pic: data.img,
|
||||
type_name: data.type,
|
||||
vod_year: data.year,
|
||||
vod_remarks: '更新至: ' + data.msg + ' / 评分: ' + data.score,
|
||||
vod_content: stripHtmlTag(data.info),
|
||||
};
|
||||
let episodes = data.player_info;
|
||||
let playlist = {};
|
||||
episodes.forEach(function(it) {
|
||||
let playurls = it.video_info;
|
||||
playurls.forEach(function(playurl) {
|
||||
let source = it.show;
|
||||
let t = formatPlayUrl(vod.vod_name, playurl.name);
|
||||
if (t.length == 0) t = playurl.name.trim();
|
||||
if (!playlist.hasOwnProperty(source)) {
|
||||
playlist[source] = [];
|
||||
}
|
||||
playlist[source].push(t + '$' + playurl.url);
|
||||
});
|
||||
});
|
||||
vod.vod_play_from = _.keys(playlist).join('$$$');
|
||||
let urls = _.values(playlist);
|
||||
let vod_play_url = [];
|
||||
urls.forEach(function(it) {
|
||||
vod_play_url.push(it.join('#'));
|
||||
});
|
||||
vod.vod_play_url = vod_play_url.join('$$$');
|
||||
return JSON.stringify({
|
||||
list: [vod],
|
||||
});
|
||||
}
|
||||
|
||||
async function play(flag, id, flags) {
|
||||
try {
|
||||
if (id.indexOf('m3u8') != -1) {
|
||||
let mjurl = id.split('url=')[1]
|
||||
return JSON.stringify({
|
||||
parse: 0,
|
||||
url: mjurl,
|
||||
});
|
||||
} else if (id.indexOf(',') != -1) {
|
||||
let mjurl = id.split(',')[1]
|
||||
let jData = JSON.parse(await request(mjurl));
|
||||
return JSON.stringify({
|
||||
parse: 0,
|
||||
url: jData.data.url,
|
||||
});
|
||||
} else {
|
||||
let mjurl = 'http://43.154.104.152:1234/jhapi/cs.php?url=' + id.split('url=')[1]
|
||||
let jData = JSON.parse(await request(mjurl));
|
||||
return JSON.stringify({
|
||||
parse: 0,
|
||||
url: jData.data.url,
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
return JSON.stringify({
|
||||
parse: 0,
|
||||
url: id,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async function search(wd, quick, pg) {
|
||||
if (pg <= 0 || typeof(pg) == 'undefined') pg = 1;
|
||||
let data = JSON.parse(await request(HOST + '/api.php/provide/search_result_more?app=ylys&video_name=' + wd + '&pageSize=20&tid=0&imei=c431ea542cee9679&page=' + pg, 'okhttp/4.6.0')).data;
|
||||
let videos = [];
|
||||
data.forEach(function(it) {
|
||||
videos.push({
|
||||
vod_id: it.id,
|
||||
vod_name: it.video_name,
|
||||
vod_pic: it.img,
|
||||
vod_remarks: it.qingxidu + '/' + it.category,
|
||||
});
|
||||
});
|
||||
let pgChk = JSON.parse(await request(HOST + '/api.php/provide/search_result_more?app=ylys&video_name=' + wd + '&pageSize=20&tid=0&imei=c431ea542cee9679&page=' + (parseInt(pg) + 1), 'okhttp/4.6.0')).msg;
|
||||
const pgCount = (pgChk == 'ok') ? parseInt(pg) + 1 : parseInt(pg);
|
||||
return JSON.stringify({
|
||||
page: parseInt(pg),
|
||||
pagecount: pgCount,
|
||||
limit: 20,
|
||||
total: 20 * pgCount,
|
||||
list: videos,
|
||||
});
|
||||
}
|
||||
|
||||
function stripHtmlTag(src) {
|
||||
return src
|
||||
.replace(/<\/?[^>]+(>|$)/g, '')
|
||||
.replace(/&.{1,5};/g, '')
|
||||
.replace(/\s{2,}/g, ' ');
|
||||
}
|
||||
|
||||
function formatPlayUrl(src, name) {
|
||||
return name
|
||||
.trim()
|
||||
.replaceAll(src, '')
|
||||
.replace(/<|>|《|》/g, '')
|
||||
.replace(/\$|#/g, ' ')
|
||||
.trim();
|
||||
}
|
||||
|
||||
export function __jsEvalReturn() {
|
||||
return {
|
||||
init: init,
|
||||
home: home,
|
||||
homeVod: homeVod,
|
||||
category: category,
|
||||
detail: detail,
|
||||
play: play,
|
||||
search: search,
|
||||
};
|
||||
}
|
135
js/sharenice_open.js
Normal file
135
js/sharenice_open.js
Normal file
@ -0,0 +1,135 @@
|
||||
// 搜索滑块验证
|
||||
import { load, _ } from './lib/cat.js';
|
||||
|
||||
let key = '短视频';
|
||||
let HOST = 'http://www.sharenice.net';
|
||||
let siteKey = '';
|
||||
let siteType = 0;
|
||||
let PC_UA = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36';
|
||||
|
||||
async function request(reqUrl, agentSp) {
|
||||
let res = await req(reqUrl, {
|
||||
method: 'get',
|
||||
headers: {
|
||||
'User-Agent': agentSp || PC_UA,
|
||||
},
|
||||
});
|
||||
return res.content;
|
||||
}
|
||||
|
||||
async function init(cfg) {
|
||||
siteKey = cfg.skey;
|
||||
siteType = cfg.stype;
|
||||
}
|
||||
|
||||
function clsjoin(cls) {
|
||||
_.each(cls, (s) => {
|
||||
let typeId = s.attribs['href'];
|
||||
typeId = typeId.substring(typeId.lastIndexOf('t/') + 2);
|
||||
classes.push({
|
||||
type_id: typeId,
|
||||
type_name: s.children[0].data,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
let classes = [];
|
||||
async function home(filter) {
|
||||
let filterObj = {};
|
||||
let html = await request(HOST);
|
||||
let $ = load(html);
|
||||
let series = $('div.nav > ul > li > a[href*=net/]');
|
||||
let tag = $('div.hot-tags-list > a[href*=net]');
|
||||
clsjoin(series);
|
||||
clsjoin(tag);
|
||||
return JSON.stringify({
|
||||
class: classes,
|
||||
filters: filterObj,
|
||||
});
|
||||
}
|
||||
|
||||
async function homeVod() {
|
||||
let link = HOST + '/t-576O5aWz';
|
||||
let html = await request(link);
|
||||
let $ = load(html);
|
||||
let items = $('div.item-box ul li');
|
||||
let videos = _.map(items, (item) => {
|
||||
let a = $(item).find('a:first')[0];
|
||||
let img = $(item).find('img:first')[0];
|
||||
return {
|
||||
vod_id: a.attribs.href,
|
||||
vod_name: a.attribs.title,
|
||||
vod_pic: img.attribs['data-original'],
|
||||
vod_remarks: '',
|
||||
};
|
||||
});
|
||||
return JSON.stringify({
|
||||
list: videos,
|
||||
});
|
||||
}
|
||||
|
||||
async function category(tid, pg, filter, extend) {
|
||||
if (pg <= 0 || typeof(pg) == 'undefined') pg = 1;
|
||||
let link = HOST + '/' + tid + '?page=' + pg;
|
||||
let html = await request(link);
|
||||
let $ = load(html);
|
||||
let items = $('div.item-box ul li');
|
||||
let videos = _.map(items, (item) => {
|
||||
let a = $(item).find('a:first')[0];
|
||||
let img = $(item).find('img:first')[0];
|
||||
return {
|
||||
vod_id: a.attribs.href,
|
||||
vod_name: a.attribs.title,
|
||||
vod_pic: img.attribs['data-original'],
|
||||
vod_remarks: '',
|
||||
};
|
||||
});
|
||||
let hasMore = $('ul.pagination > li > a:contains(»)').length > 0;
|
||||
let pgCount = hasMore ? parseInt(pg) + 1 : parseInt(pg);
|
||||
return JSON.stringify({
|
||||
page: parseInt(pg),
|
||||
pagecount: pgCount,
|
||||
limit: 16,
|
||||
total: 16 * pgCount,
|
||||
list: videos,
|
||||
});
|
||||
}
|
||||
|
||||
async function detail(id) {
|
||||
let vod = {
|
||||
vod_id: id,
|
||||
vod_remarks: '',
|
||||
};
|
||||
let playlist = ['观看视频' + '$' + id];
|
||||
vod.vod_play_from = '道长在线';
|
||||
vod.vod_play_url = playlist.join('#');
|
||||
return JSON.stringify({
|
||||
list: [vod],
|
||||
});
|
||||
}
|
||||
|
||||
async function play(flag, id, flags) {
|
||||
let html = await request(id);
|
||||
let $ = load(html);
|
||||
let playUrl = $('div.video-play-box').find('video:first')[0].attribs.src + '#.mp4';
|
||||
return JSON.stringify({
|
||||
parse: 0,
|
||||
url: playUrl,
|
||||
});
|
||||
}
|
||||
|
||||
async function search(wd, quick, pg) {
|
||||
return '{}';
|
||||
}
|
||||
|
||||
export function __jsEvalReturn() {
|
||||
return {
|
||||
init: init,
|
||||
home: home,
|
||||
homeVod: homeVod,
|
||||
category: category,
|
||||
detail: detail,
|
||||
play: play,
|
||||
search: search,
|
||||
};
|
||||
}
|
182
js/subaibai_open.js
Normal file
182
js/subaibai_open.js
Normal file
File diff suppressed because one or more lines are too long
155
js/wogg_open.js
Normal file
155
js/wogg_open.js
Normal file
@ -0,0 +1,155 @@
|
||||
import {load, _, Uri} from './lib/cat.js';
|
||||
import {log} from './lib/utils.js';
|
||||
import {initAli, detailContent, playContent} from './lib/ali.js';
|
||||
|
||||
let siteKey = 'wogg';
|
||||
let siteType = 0;
|
||||
let siteUrl = 'https://wogg.xyz';
|
||||
let 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";
|
||||
let patternAli = /(https:\/\/www\.aliyundrive\.com\/s\/[^"]+)/
|
||||
|
||||
async function init(cfg) {
|
||||
try {
|
||||
siteKey = _.isEmpty(cfg.skey) ? '' : cfg.skey;
|
||||
siteType = _.isEmpty(cfg.stype) ? '' : cfg.stype;
|
||||
await initAli(cfg);
|
||||
} catch (e) {
|
||||
await log('init:' + e.message + ' line:' + e.lineNumber);
|
||||
}
|
||||
}
|
||||
|
||||
async function request(reqUrl, agentSp) {
|
||||
let header = {
|
||||
'user-agent': agentSp || 'okhttp/3.12.0',
|
||||
};
|
||||
let uri = new Uri(reqUrl);
|
||||
let res = await req(uri.toString(), {
|
||||
headers: header,
|
||||
timeout: 10000
|
||||
});
|
||||
let content = res.content;
|
||||
return content;
|
||||
}
|
||||
|
||||
function getHeader() {
|
||||
let header = {};
|
||||
header['User-Agent'] = UA;
|
||||
return header;
|
||||
}
|
||||
|
||||
async function getString(url) {
|
||||
let res = await req(url, {
|
||||
headers: getHeader()
|
||||
});
|
||||
return res.content;
|
||||
}
|
||||
|
||||
let classes = [{'type_id': 1, 'type_name' : '电影'},{'type_id': 20, 'type_name' : '电视剧'},{'type_id': 28, 'type_name' : '综艺'},{'type_id': 24, 'type_name' : '动漫'},{'type_id': 32, 'type_name' : '音乐'}];
|
||||
let filterObj = {};
|
||||
async function home(filter) {
|
||||
return JSON.stringify({
|
||||
class: classes,
|
||||
filters: filterObj,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
async function homeVod() {
|
||||
return '{}';
|
||||
}
|
||||
|
||||
|
||||
async function category(tid, pg, filter, extend) {
|
||||
let reqUrl = siteUrl + '/index.php/vodshow/'+tid+'--------'+pg+'---.html';
|
||||
let con = await request(reqUrl, UA);
|
||||
const $ = load(con);
|
||||
let items = $('.module:eq(0) > .module-list > .module-items > .module-item');
|
||||
let videos = [];
|
||||
for(var item of items) {
|
||||
let oneA = $(item).find('.module-item-cover .module-item-pic a').first();
|
||||
let href = oneA.attr('href');
|
||||
let name = oneA.attr('title');
|
||||
let oneImg = $(item).find('.module-item-cover .module-item-pic img').first();
|
||||
let pic = oneImg.attr('data-src');
|
||||
let remark = $(item).find('.module-item-text').first().text();
|
||||
videos.push({
|
||||
vod_id: href,
|
||||
vod_name: name,
|
||||
vod_pic: pic,
|
||||
vod_remarks: remark,
|
||||
});
|
||||
}
|
||||
|
||||
const hasMore = $('#page > a:contains(下一页)').length > 0;
|
||||
const pgCount = hasMore ? parseInt(pg) + 1 : parseInt(pg);
|
||||
return JSON.stringify({
|
||||
page: parseInt(pg),
|
||||
pagecount: pgCount,
|
||||
limit: 72,
|
||||
total: 72 * pgCount,
|
||||
list: videos,
|
||||
});
|
||||
}
|
||||
|
||||
async function detail(id) {
|
||||
try {
|
||||
await log('detail:id:---' + id);
|
||||
let preMatches = id.match(patternAli);
|
||||
if (!_.isEmpty(preMatches)) return await detailContent(preMatches[1]);
|
||||
let url = siteUrl + id;
|
||||
let aliUrl = await getString(url);
|
||||
let matches = aliUrl.match(patternAli);
|
||||
console.log('detailmatche---');
|
||||
console.log(matches[1]);
|
||||
if (!_.isEmpty(matches)) return await detailContent(matches[1]);
|
||||
return '';
|
||||
} catch (e) {
|
||||
await log( 'detail:' + e.message + ' line:' + e.lineNumber);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async function play(flag, id, flags) {
|
||||
try {
|
||||
return await playContent(flag, id, flags);
|
||||
} catch (e) {
|
||||
await log( 'play:' + e.message + ' line:' + e.lineNumber);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async function search(wd, quick) {
|
||||
await log('search---' + wd);
|
||||
let searchUrl = siteUrl + '/index.php/vodsearch/-------------.html?wd=' + wd;
|
||||
let html = await getString(searchUrl);
|
||||
let $ = load(html);
|
||||
let items = $('.module-search-item');
|
||||
let videos = [];
|
||||
for(var item of items) {
|
||||
let vodId = $(item).find(".video-serial")[0].attribs.href;
|
||||
let name = $(item).find(".video-serial")[0].attribs.title;
|
||||
let pic = $(item).find(".module-item-pic > img")[0].attribs['data-src'];
|
||||
let remark = '';
|
||||
videos.push({
|
||||
vod_id: vodId,
|
||||
vod_name: name,
|
||||
vod_pic: pic,
|
||||
vod_remarks: remark,
|
||||
});
|
||||
}
|
||||
return JSON.stringify({
|
||||
list: videos,
|
||||
});
|
||||
}
|
||||
|
||||
export function __jsEvalReturn() {
|
||||
return {
|
||||
init: init,
|
||||
home: home,
|
||||
homeVod: homeVod,
|
||||
category: category,
|
||||
detail: detail,
|
||||
play: play,
|
||||
search: search,
|
||||
};
|
||||
}
|
266
js/wrapper/index.js
Normal file
266
js/wrapper/index.js
Normal file
@ -0,0 +1,266 @@
|
||||
// !!!!! Do not use in release mode. Just a native inject fake wrapper for test spider. !!!!!
|
||||
// !!!!! Do not use in release mode. Just a native inject fake wrapper for test spider. !!!!!
|
||||
// !!!!! Do not use in release mode. Just a native inject fake wrapper for test spider. !!!!!
|
||||
import axios from 'axios';
|
||||
import crypto from 'crypto';
|
||||
import https from 'https';
|
||||
import fs from 'node:fs';
|
||||
import qs from 'qs';
|
||||
import { Uri, _ } from '../lib/cat.js';
|
||||
|
||||
const confs = {};
|
||||
|
||||
function initLocalStorage(storage) {
|
||||
if (!_.has(confs, storage)) {
|
||||
if (!fs.existsSync('local')) {
|
||||
fs.mkdirSync('local');
|
||||
}
|
||||
|
||||
const storagePath = 'local/js_' + storage;
|
||||
|
||||
if (!fs.existsSync(storagePath)) {
|
||||
fs.writeFileSync(storagePath, '{}');
|
||||
confs[storage] = {};
|
||||
} else {
|
||||
confs[storage] = JSON.parse(fs.readFileSync(storagePath).toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function localGet(storage, key) {
|
||||
initLocalStorage(storage);
|
||||
return _.get(confs[storage], key, '');
|
||||
}
|
||||
|
||||
function localSet(storage, key, value) {
|
||||
initLocalStorage(storage);
|
||||
confs[storage][key] = value;
|
||||
fs.writeFileSync('local/js_' + storage, JSON.stringify(confs[storage]));
|
||||
}
|
||||
|
||||
async function request(url, opt) {
|
||||
try {
|
||||
var data = opt ? opt.data || null : null;
|
||||
var postType = opt ? opt.postType || null : null;
|
||||
var returnBuffer = opt ? opt.buffer || 0 : 0;
|
||||
var timeout = opt ? opt.timeout || 5000 : 5000;
|
||||
|
||||
var headers = opt ? opt.headers || {} : {};
|
||||
if (postType == 'form') {
|
||||
headers['Content-Type'] = 'application/x-www-form-urlencoded';
|
||||
|
||||
if (data != null) {
|
||||
data = qs.stringify(data, { encode: false });
|
||||
}
|
||||
}
|
||||
let respType = returnBuffer == 1 || returnBuffer == 2 ? 'arraybuffer' : undefined;
|
||||
var resp = await axios(url, {
|
||||
responseType: respType,
|
||||
method: opt ? opt.method || 'get' : 'get',
|
||||
headers: headers,
|
||||
data: data,
|
||||
timeout: timeout,
|
||||
httpsAgent: https.Agent({
|
||||
rejectUnauthorized: false,
|
||||
}),
|
||||
});
|
||||
var data = resp.data;
|
||||
|
||||
var resHeader = {};
|
||||
for (const hks of resp.headers) {
|
||||
var v = hks[1];
|
||||
resHeader[hks[0]] = Array.isArray(v) ? (v.length == 1 ? v[0] : v) : v;
|
||||
}
|
||||
|
||||
if (!returnBuffer) {
|
||||
if (typeof data === 'object') {
|
||||
data = JSON.stringify(data);
|
||||
}
|
||||
} else if (returnBuffer == 1) {
|
||||
return { code: resp.status, headers: resHeader, content: data };
|
||||
} else if (returnBuffer == 2) {
|
||||
return { code: resp.status, headers: resHeader, content: data.toString('base64') };
|
||||
}
|
||||
return { code: resp.status, headers: resHeader, content: data };
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
return { headers: {}, content: '' };
|
||||
}
|
||||
|
||||
function base64EncodeBuf(buff, urlsafe = false) {
|
||||
return buff.toString(urlsafe ? 'base64url' : 'base64');
|
||||
}
|
||||
|
||||
function base64Encode(text, urlsafe = false) {
|
||||
return base64EncodeBuf(Buffer.from(text, 'utf8'), urlsafe);
|
||||
}
|
||||
|
||||
function base64DecodeBuf(text) {
|
||||
return Buffer.from(text, 'base64');
|
||||
}
|
||||
|
||||
function base64Decode(text) {
|
||||
return base64DecodeBuf(text).toString('utf8');
|
||||
}
|
||||
|
||||
function md5(text) {
|
||||
return crypto.createHash('md5').update(Buffer.from(text, 'utf8')).digest('hex');
|
||||
}
|
||||
|
||||
function aes(mode, encrypt, input, inBase64, key, iv, outBase64) {
|
||||
if (iv.length == 0) iv = null;
|
||||
try {
|
||||
if (mode.startsWith('AES/CBC')) {
|
||||
switch (key.length) {
|
||||
case 16:
|
||||
mode = 'aes-128-cbc';
|
||||
break;
|
||||
case 32:
|
||||
mode = 'aes-256-cbc';
|
||||
break;
|
||||
}
|
||||
} else if (mode.startsWith('AES/ECB')) {
|
||||
switch (key.length) {
|
||||
case 16:
|
||||
mode = 'aes-128-ecb';
|
||||
break;
|
||||
case 32:
|
||||
mode = 'aes-256-ecb';
|
||||
break;
|
||||
}
|
||||
}
|
||||
const inBuf = inBase64 ? base64DecodeBuf(input) : Buffer.from(input, 'utf8');
|
||||
let keyBuf = Buffer.from(key);
|
||||
if (keyBuf.length < 16) keyBuf = Buffer.concat([keyBuf], 16);
|
||||
let ivBuf = iv == null ? Buffer.alloc(0) : Buffer.from(iv);
|
||||
if (iv != null && ivBuf.length < 16) ivBuf = Buffer.concat([ivBuf], 16);
|
||||
const cipher = encrypt ? crypto.createCipheriv(mode, keyBuf, ivBuf) : crypto.createDecipheriv(mode, keyBuf, ivBuf);
|
||||
const outBuf = Buffer.concat([cipher.update(inBuf), cipher.final()]);
|
||||
return outBase64 ? base64EncodeBuf(outBuf) : outBuf.toString('utf8');
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
function des(mode, encrypt, input, inBase64, key, iv, outBase64) {
|
||||
try {
|
||||
if (mode.startsWith('DESede/CBC')) {
|
||||
// https://stackoverflow.com/questions/29831300/convert-desede-ecb-nopadding-algorithm-written-in-java-into-nodejs-using-crypto
|
||||
switch (key.length) {
|
||||
case 16:
|
||||
mode = 'des-ede-cbc';
|
||||
break;
|
||||
case 24:
|
||||
mode = 'des-ede3-cbc';
|
||||
break;
|
||||
}
|
||||
}
|
||||
const inBuf = inBase64 ? base64DecodeBuf(input) : Buffer.from(input, 'utf8');
|
||||
let keyBuf = Buffer.from(key);
|
||||
if (keyBuf.length < 16) keyBuf = Buffer.concat([keyBuf], 16);
|
||||
let ivBuf = iv == null ? Buffer.alloc(0) : Buffer.from(iv);
|
||||
if (iv != null && ivBuf.length < 8) ivBuf = Buffer.concat([ivBuf], 8);
|
||||
const cipher = encrypt ? crypto.createCipheriv(mode, keyBuf, ivBuf) : crypto.createDecipheriv(mode, keyBuf, ivBuf);
|
||||
const outBuf = Buffer.concat([cipher.update(inBuf), cipher.final()]);
|
||||
return outBase64 ? base64EncodeBuf(outBuf) : outBuf.toString('utf8');
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
// pkcs8 only
|
||||
function rsa(mode, pub, encrypt, input, inBase64, key, outBase64) {
|
||||
try {
|
||||
let pd = undefined;
|
||||
const keyObj = pub ? crypto.createPublicKey(key) : crypto.createPrivateKey(key);
|
||||
if (!keyObj.asymmetricKeyDetails || !keyObj.asymmetricKeyDetails.modulusLength) return '';
|
||||
const moduleLen = keyObj.asymmetricKeyDetails.modulusLength;
|
||||
let blockLen = moduleLen / 8;
|
||||
switch (mode) {
|
||||
case 'RSA/PKCS1':
|
||||
pd = crypto.constants.RSA_PKCS1_PADDING;
|
||||
blockLen = encrypt ? blockLen - 11 : blockLen;
|
||||
break;
|
||||
case 'RSA/None/NoPadding':
|
||||
pd = crypto.constants.RSA_NO_PADDING;
|
||||
break;
|
||||
case 'RSA/None/OAEPPadding':
|
||||
pd = crypto.constants.RSA_PKCS1_OAEP_PADDING;
|
||||
blockLen = encrypt ? blockLen - 41 : blockLen;
|
||||
break;
|
||||
default:
|
||||
throw Error('not support ' + mode);
|
||||
}
|
||||
let inBuf = inBase64 ? base64DecodeBuf(input) : Buffer.from(input, 'utf8');
|
||||
let bufIdx = 0;
|
||||
let outBuf = Buffer.alloc(0);
|
||||
while (bufIdx < inBuf.length) {
|
||||
const bufEndIdx = Math.min(bufIdx + blockLen, inBuf.length);
|
||||
let tmpInBuf = inBuf.subarray(bufIdx, bufEndIdx);
|
||||
if (pd == crypto.constants.RSA_NO_PADDING) {
|
||||
if (tmpInBuf.length < blockLen) {
|
||||
tmpInBuf = Buffer.concat([Buffer.alloc(128 - tmpInBuf.length), tmpInBuf]);
|
||||
}
|
||||
}
|
||||
let tmpBuf;
|
||||
if (pub) {
|
||||
tmpBuf = encrypt ? crypto.publicEncrypt({ key: keyObj, padding: pd }, tmpInBuf) : crypto.publicDecrypt({ key: keyObj, padding: pd }, tmpInBuf);
|
||||
} else {
|
||||
tmpBuf = encrypt ? crypto.privateEncrypt({ key: keyObj, padding: pd }, tmpInBuf) : crypto.privateDecrypt({ key: keyObj, padding: pd }, tmpInBuf);
|
||||
}
|
||||
bufIdx = bufEndIdx;
|
||||
outBuf = Buffer.concat([outBuf, tmpBuf]);
|
||||
}
|
||||
return outBase64 ? base64EncodeBuf(outBuf) : outBuf.toString('utf8');
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
var 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;
|
||||
}
|
||||
|
||||
globalThis.local = {
|
||||
get: async function (storage, key) {
|
||||
return localGet(storage, key);
|
||||
},
|
||||
set: async function (storage, key, val) {
|
||||
localSet(storage, key, val);
|
||||
},
|
||||
};
|
||||
|
||||
globalThis.md5X = md5;
|
||||
globalThis.rsaX = rsa;
|
||||
globalThis.aesX = aes;
|
||||
globalThis.desX = des;
|
||||
|
||||
globalThis.req = request;
|
||||
|
||||
globalThis.url2Proxy = async function (type, url, headers) {
|
||||
let hd = Object.keys(headers).length == 0 ? '_' : encodeURIComponent(JSON.stringify(headers));
|
||||
let uri = new Uri(url);
|
||||
let path = uri.path();
|
||||
path = path.substring(path.lastIndexOf('/'));
|
||||
let ext = path.indexOf('.') >= 0 ? path.substring(path.indexOf('.')) : '.bin';
|
||||
return 'http://127.0.0.1:13333/up/' + randStr(6) + '/' + type + '/' + hd + '/' + encodeURIComponent(url) + '/' + ext;
|
||||
};
|
||||
|
||||
globalThis.js2Proxy = async function (dynamic, siteType, site, url, headers) {
|
||||
let hd = Object.keys(headers).length == 0 ? '_' : encodeURIComponent(JSON.stringify(headers));
|
||||
return (dynamic ? 'js2p://_WEB_/' : 'http://127.0.0.1:13333/jp/') + randStr(6) + '/' + siteType + '/' + site + '/' + hd + '/' + encodeURIComponent(url);
|
||||
};
|
||||
|
||||
export default {};
|
@ -1,190 +0,0 @@
|
||||
import { load, _ } from './lib/cat.js';
|
||||
|
||||
let key = '童趣';
|
||||
let HOST = 'https://www.boosj.com';
|
||||
let siteKey = '';
|
||||
let siteType = 0;
|
||||
|
||||
const MOBILE_UA = 'Mozilla/5.0 (Linux; Android 11; M2007J3SC Build/RKQ1.200826.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045714 Mobile Safari/537.36';
|
||||
|
||||
async function request(reqUrl, agentSp) {
|
||||
let res = await req(reqUrl, {
|
||||
method: 'get',
|
||||
headers: {
|
||||
'User-Agent': agentSp || MOBILE_UA,
|
||||
'Referer': HOST
|
||||
},
|
||||
});
|
||||
return res.content;
|
||||
}
|
||||
|
||||
// cfg = {skey: siteKey, ext: extend}
|
||||
async function init(cfg) {
|
||||
siteKey = cfg.skey;
|
||||
siteType = cfg.stype;
|
||||
}
|
||||
|
||||
async function home(filter) {
|
||||
const classes = [{ type_id: '', type_name: '全部' }, { type_id: 28, type_name: '辅食' }, { type_id: 582, type_name: '动画' }, { type_id: 3364, type_name: '儿童舞蹈' }, { type_id: 3366, type_name: '少儿英语' }, { type_id: 3367, type_name: '儿童歌曲' }, { type_id: 3622, type_name: '才艺' }, { type_id: 3782, type_name: '播视自制' }, { type_id: 3822, type_name: '故事' }, { type_id: 3842, type_name: '亲子教育' }, { type_id: 4402, type_name: '美术' }, { type_id: 4583, type_name: '其他' }, { type_id: 4762, type_name: '儿童游戏' }, { type_id: 4842, type_name: '识物' }, { type_id: 4843, type_name: '绘本' }, { type_id: 4844, type_name: '古诗' }, { type_id: 4845, type_name: '科普' }, { type_id: 5102, type_name: '儿童玩具' }, { type_id: 5142, type_name: '播视童趣儿童玩具' }];
|
||||
const filterObj = {};
|
||||
const jsonData = [
|
||||
{
|
||||
key: 'age',
|
||||
name: '年龄段',
|
||||
value: [
|
||||
{ n: '全部', v: '' },
|
||||
{ n: '6岁以上', v: '?p367=370' },
|
||||
{ n: '3~6岁', v: '?p367=369' },
|
||||
{ n: '0~3岁', v: '?p367=368' },
|
||||
],
|
||||
init: '',
|
||||
},
|
||||
{
|
||||
key: 'by',
|
||||
name: '排序',
|
||||
value: [
|
||||
{ n: '全部', v: '' },
|
||||
{ n: '最新发布', v: 'lately' },
|
||||
{ n: '最多播放', v: 'pop' },
|
||||
{ n: '最多评论', v: 'view' },
|
||||
],
|
||||
init: '',
|
||||
},
|
||||
];
|
||||
return JSON.stringify({
|
||||
class: _.map(classes, (cls) => {
|
||||
cls.land = 1;
|
||||
cls.ratio = 1.78;
|
||||
filterObj[cls.type_id] = jsonData;
|
||||
return cls;
|
||||
}),
|
||||
filters: filterObj,
|
||||
});
|
||||
}
|
||||
|
||||
async function homeVod() {
|
||||
const link = HOST + '/search_res_3362__3364_1_.html';
|
||||
const html = await request(link);
|
||||
const $ = load(html);
|
||||
const items = $('body div.bj-col4:has(h3)');
|
||||
let videos = _.map(items, (it) => {
|
||||
const a = $(it).find('a:first')[0];
|
||||
const img = $(it).find('img:first')[0];
|
||||
const remarks = $(it).find('span.played')[0];
|
||||
return {
|
||||
vod_id: a.attribs.href,
|
||||
vod_name: a.attribs.title,
|
||||
vod_pic: img.attribs['data-original'],
|
||||
vod_remarks: remarks.children[0].data || '',
|
||||
};
|
||||
});
|
||||
return JSON.stringify({
|
||||
list: videos,
|
||||
});
|
||||
}
|
||||
|
||||
async function category(tid, pg, filter, extend) {
|
||||
if (pg <= 0 || typeof (pg) == 'undefined') pg = 1;
|
||||
const link = HOST + '/search_res_3362__' + tid + '_' + pg + '_' + (extend.by || '') + '.html' + (extend.age || '');
|
||||
const html = await request(link);
|
||||
const $ = load(html);
|
||||
const items = $('body div.bj-col4:has(h3)');
|
||||
let videos = _.map(items, (it) => {
|
||||
const a = $(it).find('a:first')[0];
|
||||
const img = $(it).find('img:first')[0];
|
||||
const remarks = $(it).find('span.played')[0];
|
||||
return {
|
||||
vod_id: a.attribs.href,
|
||||
vod_name: a.attribs.title,
|
||||
vod_pic: img.attribs['data-original'],
|
||||
vod_remarks: remarks.children[0].data || '',
|
||||
};
|
||||
});
|
||||
const hasMore = $('div.pub_paging > a:contains(下一页)').length > 0;
|
||||
const pgCount = hasMore ? parseInt(pg) + 1 : parseInt(pg);
|
||||
return JSON.stringify({
|
||||
page: parseInt(pg),
|
||||
pagecount: pgCount,
|
||||
limit: 30,
|
||||
total: 30 * pgCount,
|
||||
list: videos,
|
||||
});
|
||||
}
|
||||
|
||||
async function detail(id) {
|
||||
const vod = {
|
||||
vod_id: id,
|
||||
vod_remarks: "",
|
||||
};
|
||||
const playlist = ["点击播放" + "$" + vod.vod_id];
|
||||
vod.vod_play_from = "道长在线";
|
||||
vod.vod_play_url = playlist.join("#");
|
||||
return JSON.stringify({
|
||||
list: [vod],
|
||||
});
|
||||
}
|
||||
|
||||
async function play(flag, id, flags) {
|
||||
const body = JSON.parse(await request('https://gslb.boosj.com/ipv2.json'));
|
||||
body._id = id.match(/\d+/)[0];
|
||||
const json = JSON.parse(await request(buildUrl(body.gslb, body)));
|
||||
const purl = json.url + '?' + json.t
|
||||
// console.debug('童趣purl =====>' + purl); // js_debug.log
|
||||
let headers = {
|
||||
'User-Agent': 'Dalvik/2.1.0 (Linux; U; Android 9; 22081212C Build/PQ3B.190801.002)',
|
||||
};
|
||||
return JSON.stringify({
|
||||
parse: 0,
|
||||
url: purl,
|
||||
header: headers,
|
||||
});
|
||||
}
|
||||
|
||||
async function search(wd, quick) {
|
||||
var data = JSON.parse(await request('https://search.boosj.com/m_ajax?q=' + wd + '&p=' + pg + '&typeId=3362')).body;
|
||||
let videos = _.map(data.result, (it) => {
|
||||
return {
|
||||
vod_id: it.playUrl,
|
||||
vod_name: it.resourceName,
|
||||
vod_pic: it.imageUrl,
|
||||
vod_remarks: it.clickNumStr || '',
|
||||
}
|
||||
});
|
||||
return JSON.stringify({
|
||||
page: parseInt(pg),
|
||||
pagecount: data.pageCount,
|
||||
limit: 30,
|
||||
total: data.rowCount,
|
||||
list: videos,
|
||||
});
|
||||
}
|
||||
|
||||
function buildUrl(url, obj) {
|
||||
obj = obj || {};
|
||||
if (url.indexOf('?') < 0) {
|
||||
url += '?'
|
||||
}
|
||||
let param_list = [];
|
||||
let keys = Object.keys(obj);
|
||||
keys.forEach(it => {
|
||||
param_list.push(it + '=' + obj[it])
|
||||
});
|
||||
let prs = param_list.join('&');
|
||||
if (keys.length > 0 && !url.endsWith('?')) {
|
||||
url += '&'
|
||||
}
|
||||
url += prs;
|
||||
return url
|
||||
}
|
||||
|
||||
export function __jsEvalReturn() {
|
||||
return {
|
||||
init: init,
|
||||
home: home,
|
||||
homeVod: homeVod,
|
||||
category: category,
|
||||
detail: detail,
|
||||
play: play,
|
||||
search: search,
|
||||
};
|
||||
}
|
File diff suppressed because one or more lines are too long
109
lib/cntv_open.js
109
lib/cntv_open.js
@ -1,109 +0,0 @@
|
||||
// 无搜索功能
|
||||
import { _ } from './lib/cat.js';
|
||||
let key = '视聚场';
|
||||
let HOST = 'http://api.cntv.cn';
|
||||
let siteKey = '';
|
||||
let siteType = 0;
|
||||
const MOBILE_UA = 'Mozilla/5.0 (Linux; Android 11; M2007J3SC Build/RKQ1.200826.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045714 Mobile Safari/537.36';
|
||||
|
||||
async function request(reqUrl, agentSp) {
|
||||
let res = await req(reqUrl, {
|
||||
method: 'get',
|
||||
headers: {
|
||||
'User-Agent': agentSp || MOBILE_UA,
|
||||
},
|
||||
});
|
||||
return res.content
|
||||
}
|
||||
|
||||
async function init(cfg) {
|
||||
siteKey = cfg.skey;
|
||||
siteType = cfg.stype
|
||||
}
|
||||
|
||||
async function home(filter) {
|
||||
const classes = [{ type_id: "TOPC1451528971114112", type_name: "新闻联播" }, { type_id: "TOPC1451558976694518", type_name: "焦点访谈" }, { type_id: "TOPC1451464665008914", type_name: "今日说法" }, { type_id: "TOPC1451378757637200", type_name: "等着我" }, { type_id: "TOPC1451559129520755", type_name: "新闻直播间" }, { type_id: "TOPC1451540328102649", type_name: "海峡两岸" }, { type_id: "TOPC1451530382483536", type_name: "天网" }, { type_id: "TOPC1451540389082713", type_name: "今日关注" }, { type_id: "TOPC1451557893544236", type_name: "探索·发现" }, { type_id: "TOPC1665739007799851", type_name: "高端访谈" }, { type_id: "TOPC1451557052519584", type_name: "百家讲坛" }, { type_id: "TOPC1451464884159276", type_name: "开讲啦" }, { type_id: "TOPC1451464884159276", type_name: "故事里的中国" }, { type_id: "TOPC1514182710380601", type_name: "对话" }, { type_id: "TOPC1451559038345600", type_name: "面对面" }, { type_id: "TOPC1451378967257534", type_name: "动物世界" }, { type_id: "TOPC1451558190239536", type_name: "走进科学" }, { type_id: "TOPC1451525103989666", type_name: "人与自然" }, { type_id: "TOPC1451557421544786", type_name: "地理·中国" }, { type_id: "TOPC1451541349400938", type_name: "远方的家" }, { type_id: "TOPC1451558150787467", type_name: "自然传奇" }, { type_id: "TOPC1451534366388377", type_name: "是真的吗" }, { type_id: "TOPC1451467630488780", type_name: "星光大道" }, { type_id: "TOPC1451557646802924", type_name: "健康之路" }, { type_id: "TOPC1451559025546574", type_name: "动画大放映" }, { type_id: "TOPC1451378857272262", type_name: "第一动画乐园" }, { type_id: "TOPC1451541414450906", type_name: "精彩音乐汇" }, { type_id: "TOPC1451534421925242", type_name: "音乐厅" }, { type_id: "TOPC1451541994820527", type_name: "民歌·中国" }, { type_id: "TOPC1575253587571324", type_name: "跟着书本去旅行" }, { type_id: "TOPC1451354597100320", type_name: "中国电影报道" }, { type_id: "TOPC1451469943519994", type_name: "星推荐" }, { type_id: "TOPC1571217727564820", type_name: "方圆剧阵" }, { type_id: "TOPC1451558856402351", type_name: "空中剧院" }, { type_id: "TOPC1650782829200997", type_name: "正大综艺" }, { type_id: "TOPC1451550970356385", type_name: "体坛快讯" }, { type_id: "TOPC1451530259915198", type_name: "第一时间" }, { type_id: "TOPC1451465894294259", type_name: "开门大吉" }, { type_id: "TOPC1451464884159276", type_name: "开讲啦" }, { type_id: "TOPC1451558858788377", type_name: "共同关注" }, { type_id: "TOPC1451527941788652", type_name: "军事报道" }, { type_id: "TOPC1451558819463311", type_name: "新闻调查" }, { type_id: "TOPC1451559097947700", type_name: "新闻30分" }, { type_id: "TOPC1451559066181661", type_name: "新闻1+1" }, { type_id: "TOPC1451540448405749", type_name: "今日亚洲" }, { type_id: "TOPC1451559129520755", type_name: "新闻直播间" }, { type_id: "TOPC1451558428005729", type_name: "24小时" }, { type_id: "TOPC1451539894330405", type_name: "中国新闻" }, { type_id: "TOPC1451558779639282", type_name: "午夜新闻" }, { type_id: "TOPC1451558496100826", type_name: "朝闻天下" }, { type_id: "TOPC1451528792881669", type_name: "晚间新闻" }, { type_id: "TOPC1451559180488841", type_name: "新闻周刊" }, { type_id: "TOPC1601362002656197", type_name: "经济半小时" }, { type_id: "TOPC1451533652476962", type_name: "经济大讲堂" }, { type_id: "TOPC1453100395512779", type_name: "正点财经" }, { type_id: "TOPC1451546588784893", type_name: "生活圈" }, { type_id: "TOPC1451526037568184", type_name: "生活提示" }, { type_id: "TOPC1451558532019883", type_name: "东方时空" }, { type_id: "TOPC1451533782742171", type_name: "经济信息联播" }, { type_id: "TOPC1571034705435323", type_name: "今日环球" }, { type_id: "TOPC1451543462858283", type_name: "一线" }];
|
||||
const filterObj = {};
|
||||
return JSON.stringify({
|
||||
class: _.map(classes, (cls) => {
|
||||
cls.land = 1;
|
||||
cls.ratio = 1.78;
|
||||
return cls;
|
||||
}),
|
||||
filters: filterObj,
|
||||
})
|
||||
}
|
||||
|
||||
async function homeVod() {
|
||||
const data = JSON.parse(await request(HOST + '/NewVideo/getVideoListByColumn?id=TOPC1451558856402351&n=10&sort=desc&p=1&mode=0&serviceId=tvcctv'));
|
||||
let videos = _.map(data.data.list, (it) => {
|
||||
return {
|
||||
vod_id: it.guid,
|
||||
vod_name: it.title,
|
||||
vod_pic: it.image,
|
||||
vod_remarks: it.time || '',
|
||||
}
|
||||
});
|
||||
return JSON.stringify({
|
||||
list: videos,
|
||||
})
|
||||
}
|
||||
|
||||
async function category(tid, pg, filter, extend) {
|
||||
if (pg <= 0 || typeof pg == 'undefined') pg = 1;
|
||||
const data = JSON.parse(await request(HOST + '/NewVideo/getVideoListByColumn?id=' + tid + '&n=10&sort=desc&p=' + pg + '&mode=0&serviceId=tvcctv'));
|
||||
let videos = _.map(data.data.list, (it) => {
|
||||
return {
|
||||
vod_id: it.guid,
|
||||
vod_name: it.title,
|
||||
vod_pic: it.image,
|
||||
vod_remarks: it.time || '',
|
||||
}
|
||||
});
|
||||
const pgChk = JSON.parse(await request(HOST + '/NewVideo/getVideoListByColumn?id=' + tid + '&n=10&sort=desc&p=' + (parseInt(pg) + 1) + '&mode=0&serviceId=tvcctv')).data.list;
|
||||
const pgCount = pgChk.length > 0 ? parseInt(pg) + 1 : parseInt(pg);
|
||||
return JSON.stringify({
|
||||
page: parseInt(pg),
|
||||
pagecount: parseInt(pgCount),
|
||||
limit: 10,
|
||||
total: parseInt(data.total),
|
||||
list: videos,
|
||||
})
|
||||
}
|
||||
|
||||
async function detail(id) {
|
||||
const vod = {
|
||||
vod_id: id,
|
||||
vod_remarks: '',
|
||||
};
|
||||
const playlist = ['点击播放' + '$' + 'https://hls.cntv.myhwcdn.cn/asp/hls/2000/0303000a/3/default/' + id + '/2000.m3u8'];
|
||||
vod.vod_play_from = key;
|
||||
vod.vod_play_url = playlist.join('#');
|
||||
return JSON.stringify({
|
||||
list: [vod],
|
||||
});
|
||||
}
|
||||
|
||||
async function play(flag, id, flags) {
|
||||
// console.debug('视聚场 id =====>' + id); // js_debug.log
|
||||
return JSON.stringify({
|
||||
parse: 0,
|
||||
url: id,
|
||||
})
|
||||
}
|
||||
|
||||
async function search(wd, quick, pg) {
|
||||
return '{}'
|
||||
}
|
||||
|
||||
export function __jsEvalReturn() {
|
||||
return {
|
||||
init: init,
|
||||
home: home,
|
||||
homeVod: homeVod,
|
||||
category: category,
|
||||
detail: detail,
|
||||
play: play,
|
||||
search: search,
|
||||
}
|
||||
}
|
@ -1,156 +0,0 @@
|
||||
import { load, _ } from "assets://js/lib/cat.js";
|
||||
|
||||
let key = "世纪DJ音乐网";
|
||||
let HOST = "http://m.dj0898.com";
|
||||
let siteKey = "";
|
||||
let siteType = 0;
|
||||
|
||||
const MOBILE_UA = "Mozilla/5.0 (Linux; Android 11; M2007J3SC Build/RKQ1.200826.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045714 Mobile Safari/537.36";
|
||||
|
||||
async function request(reqUrl, agentSp) {
|
||||
let res = await req(reqUrl, {
|
||||
method: "get",
|
||||
headers: {
|
||||
"User-Agent": agentSp || MOBILE_UA,
|
||||
Referer: HOST,
|
||||
},
|
||||
});
|
||||
return res.content;
|
||||
}
|
||||
|
||||
async function init(cfg) {
|
||||
siteKey = cfg.skey;
|
||||
siteType = cfg.stype;
|
||||
}
|
||||
|
||||
async function home(filter) {
|
||||
const classes = [{ type_id: 1, type_name: "🎧串烧舞曲" }, { type_id: 2, type_name: "🎧外文舞曲" }, { type_id: 3, type_name: "🎧早场暖场" }, { type_id: 4, type_name: "🎧中文舞曲" }, { type_id: 5, type_name: "🎧其他舞曲" }, { type_id: 6, type_name: "🎧国外电音" }, { type_id: 8, type_name: "🎧慢歌连版" }, { type_id: 9, type_name: "🎧酒吧潮歌" }, { type_id: 10, type_name: "🎧中文串烧" }, { type_id: 11, type_name: "🎧外文串烧" }, { type_id: 12, type_name: "🎧中外串烧" }, { type_id: 13, type_name: "🎧车载串烧" }, { type_id: 14, type_name: "🎧越鼓串烧" }, { type_id: 40, type_name: "🎧3D/环绕" }, { type_id: 45, type_name: "🎧口水旋律" }, { type_id: 46, type_name: "🎧精品收藏" }, { type_id: 47, type_name: "🎧开场舞曲" }, { type_id: 48, type_name: "🎧印度舞曲" }, { type_id: 49, type_name: "🎧编排套曲" }, { type_id: 20, type_name: "🎧DuTch" }, { type_id: 21, type_name: "🎧Mash up" }, { type_id: 22, type_name: "🎧ClubHouse" }, { type_id: 23, type_name: "🎧ElectroHouse" }, { type_id: 24, type_name: "🎧越南鼓Dj" }, { type_id: 30, type_name: "🎧Funky" }, { type_id: 31, type_name: "🎧Reggae" }, { type_id: 32, type_name: "🎧Rnb" }, { type_id: 33, type_name: "🎧Hip Hop" }, { type_id: 34, type_name: "🎧Dubstep" }, { type_id: 8017, type_name: "🎧Hardstyle" }, { type_id: 8018, type_name: "🎧Hands Up" }];
|
||||
const filterObj = {};
|
||||
return JSON.stringify({
|
||||
class: _.map(classes, (cls) => {
|
||||
cls.land = 1;
|
||||
cls.ratio = 1.78;
|
||||
return cls;
|
||||
}),
|
||||
filters: filterObj,
|
||||
});
|
||||
}
|
||||
|
||||
async function homeVod() {
|
||||
const link = HOST + "/dance/lists/id/10/1";
|
||||
const html = await request(link);
|
||||
const $ = load(html);
|
||||
const list = $("ul.djddv_djList > li");
|
||||
let videos = _.map(list, (it) => {
|
||||
const a = $(it).find("a")[1];
|
||||
const img = $(it).find("img:first")[0];
|
||||
const tt = $(it).find("strong:first")[0];
|
||||
const remarks = $(it).find("font")[5];
|
||||
return {
|
||||
vod_id: a.attribs.href,
|
||||
vod_name: tt.children[0].data,
|
||||
vod_pic: img.attribs["src"],
|
||||
vod_remarks: "🎵" + remarks.children[0].data || "",
|
||||
};
|
||||
});
|
||||
return JSON.stringify({
|
||||
list: videos,
|
||||
});
|
||||
}
|
||||
|
||||
async function category(tid, pg, filter, extend) {
|
||||
if (pg <= 0 || typeof pg == "undefined") pg = 1;
|
||||
const link = HOST + "/dance/lists/id/" + tid + "/" + pg;
|
||||
const html = await request(link);
|
||||
const $ = load(html);
|
||||
const list = $("ul.djddv_djList > li");
|
||||
let videos = _.map(list, (it) => {
|
||||
const a = $(it).find("a")[1];
|
||||
const img = $(it).find("img:first")[0];
|
||||
const tt = $(it).find("strong:first")[0];
|
||||
const remarks = $(it).find("font")[5];
|
||||
return {
|
||||
vod_id: a.attribs.href,
|
||||
vod_name: tt.children[0].data,
|
||||
vod_pic: img.attribs["src"],
|
||||
vod_remarks: "🎵" + remarks.children[0].data || "",
|
||||
};
|
||||
});
|
||||
const hasMore = $("ul.page_link > li > a:contains(\u00a0)").length > 0;
|
||||
const pgCount = hasMore ? parseInt(pg) + 1 : parseInt(pg);
|
||||
return JSON.stringify({
|
||||
page: parseInt(pg),
|
||||
pagecount: pgCount,
|
||||
limit: 60,
|
||||
total: 60 * pgCount,
|
||||
list: videos,
|
||||
});
|
||||
}
|
||||
|
||||
async function detail(id) {
|
||||
const vod = {
|
||||
vod_id: id,
|
||||
vod_remarks: "",
|
||||
};
|
||||
const playlist = ["点击播放" + "$" + vod.vod_id];
|
||||
vod.vod_play_from = "道长在线";
|
||||
vod.vod_play_url = playlist.join("#");
|
||||
return JSON.stringify({
|
||||
list: [vod],
|
||||
});
|
||||
}
|
||||
|
||||
async function play(flag, id, flags) {
|
||||
const html = await request(id);
|
||||
const $ = load(html);
|
||||
const audio = $("body audio[src*=http]");
|
||||
const audioUrl = audio[0].attribs.src;
|
||||
// console.debug('世纪DJ音乐网 audioUrl =====>' + audioUrl); // js_debug.log
|
||||
return JSON.stringify({
|
||||
parse: 0,
|
||||
url: audioUrl,
|
||||
});
|
||||
}
|
||||
|
||||
async function search(wd, quick, pg) {
|
||||
if (pg <= 0 || typeof pg == "undefined") pg = 1;
|
||||
const link = HOST + "/index.php/dance/so/key?key=" + wd + "&cid=0&p=" + pg;
|
||||
const html = await request(link);
|
||||
const $ = load(html);
|
||||
const list = $("ul.djddv_djList > li");
|
||||
let videos = _.map(list, (it) => {
|
||||
const a = $(it).find("a")[1];
|
||||
const img = $(it).find("img:first")[0];
|
||||
const tt = $(it).find("strong:first")[0];
|
||||
const remarks = $(it).find("font:first")[0];
|
||||
return {
|
||||
vod_id: a.attribs.href,
|
||||
vod_name: tt.children[0].data,
|
||||
vod_pic: img.attribs["src"],
|
||||
vod_remarks: "🎵" + remarks.children[0].data || "",
|
||||
};
|
||||
});
|
||||
const hasMore = $("ul.page_link > li > a:contains(\u00a0)").length > 0;
|
||||
const pgCount = hasMore ? parseInt(pg) + 1 : parseInt(pg);
|
||||
return JSON.stringify({
|
||||
page: parseInt(pg),
|
||||
pagecount: pgCount,
|
||||
limit: 60,
|
||||
total: 60 * pgCount,
|
||||
list: videos,
|
||||
land: 1,
|
||||
ratio: 1.78,
|
||||
});
|
||||
}
|
||||
|
||||
export function __jsEvalReturn() {
|
||||
return {
|
||||
init: init,
|
||||
home: home,
|
||||
homeVod: homeVod,
|
||||
category: category,
|
||||
detail: detail,
|
||||
play: play,
|
||||
search: search,
|
||||
};
|
||||
}
|
@ -1,173 +0,0 @@
|
||||
// 修正:分类改静态 (网站频繁变动分类)
|
||||
import { load, _ } from "assets://js/lib/cat.js";
|
||||
|
||||
let key = "酷奇MV";
|
||||
let HOST = "https://www.kuqimv.com";
|
||||
let siteKey = "";
|
||||
let siteType = 0;
|
||||
const PC_UA = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36";
|
||||
|
||||
async function request(reqUrl, referer, mth, data, hd) {
|
||||
const headers = {
|
||||
"User-Agent": PC_UA,
|
||||
};
|
||||
if (referer) headers.referer = encodeURIComponent(referer);
|
||||
let res = await req(reqUrl, {
|
||||
method: mth || "get",
|
||||
headers: headers,
|
||||
data: data,
|
||||
postType: mth === "post" ? "form" : "",
|
||||
});
|
||||
return res.content;
|
||||
}
|
||||
|
||||
async function init(cfg) {
|
||||
siteKey = cfg.skey;
|
||||
siteType = cfg.stype;
|
||||
}
|
||||
|
||||
async function home(filter) {
|
||||
var classes = [{ "type_id": "1", "type_name": "华语高清" }, { "type_id": "2", "type_name": "日韩精选" }, { "type_id": "3", "type_name": "欧美MV" }, { "type_id": "4", "type_name": "高清现场" }, { "type_id": "5", "type_name": "影视MV" }, { "type_id": "6", "type_name": "夜店视频" }, { "type_id": "7", "type_name": "车模视频" }, { "type_id": "8", "type_name": "热舞视频" }, { "type_id": "9", "type_name": "美女写真" }, { "type_id": "10", "type_name": "美女打碟" }];
|
||||
// const html = await request(HOST);
|
||||
// const $ = load(html);
|
||||
// const class_parse = $(".lei_fl > a[href*=play]");
|
||||
// const classes = [];
|
||||
// classes = _.map(class_parse, (cls) => {
|
||||
// const typeId = cls.attribs["href"];
|
||||
// typeId = typeId.substring(typeId.lastIndexOf("/") + 1).replace(".html", "");
|
||||
// return {
|
||||
// type_id: typeId,
|
||||
// type_name: cls.children[0].data,
|
||||
// };
|
||||
// });
|
||||
const filterObj = {};
|
||||
return JSON.stringify({
|
||||
class: _.map(classes, (cls) => {
|
||||
cls.land = 1;
|
||||
cls.ratio = 1.78;
|
||||
return cls;
|
||||
}),
|
||||
filters: filterObj,
|
||||
});
|
||||
}
|
||||
|
||||
async function homeVod() {
|
||||
const link = HOST + "/play/9_1.html";
|
||||
const html = await request(link);
|
||||
const $ = load(html);
|
||||
const items = $("div.mv_list > li");
|
||||
let videos = _.map(items, (it) => {
|
||||
const a = $(it).find("a:first")[0];
|
||||
const img = $(it).find("img:first")[0];
|
||||
const singer = $($(it).find("div.singer")[0]).text().trim();
|
||||
const remarks = $($(it).find("span.lei_03")[0]).text().trim();
|
||||
return {
|
||||
vod_id: a.attribs.href.replace(/.*?\/play\/(.*).html/g, "$1"),
|
||||
vod_name: a.attribs.title,
|
||||
vod_pic: img.attribs["src"],
|
||||
vod_remarks: "🎤" + singer + "|" + remarks || "",
|
||||
};
|
||||
});
|
||||
return JSON.stringify({
|
||||
list: videos,
|
||||
});
|
||||
}
|
||||
|
||||
async function category(tid, pg, filter, extend) {
|
||||
if (pg <= 0 || typeof pg == "undefined") pg = 1;
|
||||
const link = HOST + "/play/" + tid + "_" + pg + ".html";
|
||||
const html = await request(link);
|
||||
const $ = load(html);
|
||||
const items = $("div.mv_list > li");
|
||||
let videos = _.map(items, (it) => {
|
||||
const a = $(it).find("a:first")[0];
|
||||
const img = $(it).find("img:first")[0];
|
||||
const singer = $($(it).find("div.singer")[0]).text().trim();
|
||||
const remarks = $($(it).find("span.lei_03")[0]).text().trim();
|
||||
return {
|
||||
vod_id: a.attribs.href.replace(/.*?\/play\/(.*).html/g, "$1"),
|
||||
vod_name: a.attribs.title,
|
||||
vod_pic: img.attribs["src"],
|
||||
vod_remarks: "🎤" + singer + "|" + remarks || "",
|
||||
};
|
||||
});
|
||||
const hasMore = $("div.lei_page > 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 vod = {
|
||||
vod_id: id,
|
||||
vod_remarks: "",
|
||||
};
|
||||
const playlist = ["观看视频" + "$" + id];
|
||||
vod.vod_play_from = "道长在线";
|
||||
vod.vod_play_url = playlist.join("#");
|
||||
return JSON.stringify({
|
||||
list: [vod],
|
||||
});
|
||||
}
|
||||
|
||||
async function play(flag, id, flags) {
|
||||
const link = HOST + "/skin/kuqimv/play.php";
|
||||
const ref = HOST + "/play/" + id + ".html";
|
||||
const pdata = { id: id };
|
||||
const playUrl = JSON.parse(await request(link, ref, "post", pdata)).url;
|
||||
const headers = {
|
||||
Referer: HOST,
|
||||
};
|
||||
return JSON.stringify({
|
||||
parse: 0,
|
||||
url: playUrl,
|
||||
header: headers,
|
||||
});
|
||||
}
|
||||
|
||||
async function search(wd, quick, pg) {
|
||||
if (pg <= 0 || typeof pg == "undefined") pg = 1;
|
||||
const link = HOST + "/search.php?key=" + wd + "&pages=" + pg;
|
||||
const html = await request(link);
|
||||
const $ = load(html);
|
||||
const items = $("div.video_list > li");
|
||||
let videos = _.map(items, (it) => {
|
||||
const a = $(it).find("a:first")[0];
|
||||
const singer = $($(it).find("div.singer")[0]).text().trim();
|
||||
const remarks = $($(it).find("span.lei_04")[0]).text().trim();
|
||||
return {
|
||||
vod_id: a.attribs.href.replace(/.*?\/play\/(.*).html/g, "$1"),
|
||||
vod_name: a.attribs.title,
|
||||
vod_pic: "https://www.kuqimv.com/static/images/cover/singer.jpg",
|
||||
vod_remarks: "🎤" + singer + "|" + remarks || "",
|
||||
};
|
||||
});
|
||||
const hasMore = $("div.lei_page > a:contains(>)").length > 0;
|
||||
const pgCount = hasMore ? parseInt(pg) + 1 : parseInt(pg);
|
||||
return JSON.stringify({
|
||||
page: parseInt(pg),
|
||||
pagecount: pgCount,
|
||||
limit: 20,
|
||||
total: 20 * pgCount,
|
||||
list: videos,
|
||||
land: 1,
|
||||
ratio: 1.78,
|
||||
});
|
||||
}
|
||||
|
||||
export function __jsEvalReturn() {
|
||||
return {
|
||||
init: init,
|
||||
home: home,
|
||||
homeVod: homeVod,
|
||||
category: category,
|
||||
detail: detail,
|
||||
play: play,
|
||||
search: search,
|
||||
};
|
||||
}
|
@ -1 +0,0 @@
|
||||
function compareTwoStrings(first,second){if((first=first.replace(/\s+/g,""))===(second=second.replace(/\s+/g,"")))return 1;if(first.length<2||second.length<2)return 0;var firstBigrams=new Map;for(let i=0;i<first.length-1;i++){var bigram=first.substring(i,i+2),count=firstBigrams.has(bigram)?firstBigrams.get(bigram)+1:1;firstBigrams.set(bigram,count)}let intersectionSize=0;for(let i=0;i<second.length-1;i++){const bigram=second.substring(i,i+2),count=firstBigrams.has(bigram)?firstBigrams.get(bigram):0;0<count&&(firstBigrams.set(bigram,count-1),intersectionSize++)}return 2*intersectionSize/(first.length+second.length-2)}function findBestMatch(mainString,targetStrings){var ratings=[];let bestMatchIndex=0;for(let i=0;i<targetStrings.length;i++){var currentTargetString=targetStrings[i],currentRating=compareTwoStrings(mainString,currentTargetString);ratings.push({target:currentTargetString,rating:currentRating}),currentRating>ratings[bestMatchIndex].rating&&(bestMatchIndex=i)}return{ratings:ratings,bestMatch:ratings[bestMatchIndex],bestMatchIndex:bestMatchIndex}}function lcs(str1,str2){if(!str1||!str2)return{length:0,sequence:"",offset:0};for(var sequence="",str1Length=str1.length,str2Length=str2.length,num=new Array(str1Length),maxlen=0,lastSubsBegin=0,i=0;i<str1Length;i++){for(var subArray=new Array(str2Length),j=0;j<str2Length;j++)subArray[j]=0;num[i]=subArray}for(var thisSubsBegin=null,i=0;i<str1Length;i++)for(j=0;j<str2Length;j++)str1[i]!==str2[j]?num[i][j]=0:(num[i][j]=0===i||0===j?1:1+num[i-1][j-1],num[i][j]>maxlen&&(maxlen=num[i][j],lastSubsBegin===(thisSubsBegin=i-num[i][j]+1)?sequence+=str1[i]:(lastSubsBegin=thisSubsBegin,sequence="",sequence+=str1.substr(lastSubsBegin,i+1-lastSubsBegin))));return{length:maxlen,sequence:sequence,offset:thisSubsBegin}}function findBestLCS(mainString,targetStrings){var results=[];let bestMatchIndex=0;for(let i=0;i<targetStrings.length;i++){var currentTargetString=targetStrings[i],currentLCS=lcs(mainString,currentTargetString);results.push({target:currentTargetString,lcs:currentLCS}),currentLCS.length>results[bestMatchIndex].lcs.length&&(bestMatchIndex=i)}return{allLCS:results,bestMatch:results[bestMatchIndex],bestMatchIndex:bestMatchIndex}}export{compareTwoStrings,findBestMatch,findBestLCS};
|
@ -1,135 +0,0 @@
|
||||
import { load, _ } from './lib/cat.js';
|
||||
let key = '🐰兔小贝';
|
||||
let HOST = 'https://www.tuxiaobei.com';
|
||||
let siteKey = '';
|
||||
let siteType = 0;
|
||||
const IOS_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 || IOS_UA,
|
||||
},
|
||||
});
|
||||
return res.content
|
||||
}
|
||||
|
||||
async function init(cfg) {
|
||||
siteKey = cfg.skey;
|
||||
siteType = cfg.stype
|
||||
}
|
||||
|
||||
async function home(filter) {
|
||||
const classes = [{ type_id: '', type_name: '🐰全部' }, { type_id: 2, type_name: '🐰儿歌' }, { type_id: 3, type_name: '🐰故事' }, { type_id: 27, type_name: '🐰公益' }, { type_id: 9, type_name: '🐰十万个为什么' }, { type_id: 28, type_name: '🐰安全教育' }, { type_id: 29, type_name: '🐰动物奇缘' }, { type_id: 7, type_name: '🐰弟子规' }, { type_id: 5, type_name: '🐰古诗' }, { type_id: 6, type_name: '🐰三字经' }, { type_id: 8, type_name: '🐰千字文' }, { type_id: 11, type_name: '🐰数学' }, { type_id: 25, type_name: '🐰英语' }, { type_id: 24, type_name: '🐰折纸' }];
|
||||
const filterObj = {};
|
||||
return JSON.stringify({
|
||||
class: _.map(classes, (cls) => {
|
||||
cls.land = 1;
|
||||
cls.ratio = 1.78;
|
||||
return cls;
|
||||
}),
|
||||
filters: filterObj,
|
||||
})
|
||||
}
|
||||
|
||||
async function homeVod() {
|
||||
const link = await request(HOST + '/list/mip-data?typeId=9&page=1&callback=');
|
||||
const html = link.match(/\((.*?)\);/)[1];
|
||||
const data = JSON.parse(html).data;
|
||||
let videos = _.map(data.items, (it) => {
|
||||
return {
|
||||
vod_id: it.video_id,
|
||||
vod_name: it.name,
|
||||
vod_pic: it.image,
|
||||
vod_remarks: it.root_category_name + ' | ' + it.duration_string || '',
|
||||
}
|
||||
});
|
||||
return JSON.stringify({
|
||||
list: videos,
|
||||
})
|
||||
}
|
||||
|
||||
async function category(tid, pg, filter, extend) {
|
||||
if (pg <= 0 || typeof pg == 'undefined') pg = 1;
|
||||
const link = await request(HOST + '/list/mip-data?typeId=' + tid + '&page=' + pg + '&callback=');
|
||||
const html = link.match(/\((.*?)\);/)[1];
|
||||
const data = JSON.parse(html).data;
|
||||
let videos = _.map(data.items, (it) => {
|
||||
return {
|
||||
vod_id: it.video_id,
|
||||
vod_name: it.name,
|
||||
vod_pic: it.image,
|
||||
vod_remarks: it.root_category_name + ' | ' + it.duration_string || '',
|
||||
}
|
||||
});
|
||||
const pgCount = pg * 30 > data.totalCount ? parseInt(pg) : parseInt(pg) + 1;
|
||||
return JSON.stringify({
|
||||
page: parseInt(pg),
|
||||
pagecount: pgCount,
|
||||
limit: 30,
|
||||
total: data.totalCount,
|
||||
list: videos,
|
||||
})
|
||||
}
|
||||
|
||||
async function detail(id) {
|
||||
const vod = {
|
||||
vod_id: id,
|
||||
vod_remarks: '',
|
||||
};
|
||||
const playlist = ['点击播放' + '$' + HOST + '/play/' + id];
|
||||
vod.vod_play_from = "道长在线";
|
||||
vod.vod_play_url = playlist.join('#');
|
||||
return JSON.stringify({
|
||||
list: [vod],
|
||||
});
|
||||
}
|
||||
|
||||
async function play(flag, id, flags) {
|
||||
const html = await request(id);
|
||||
const $ = load(html);
|
||||
const pvideo = $("body mip-search-video[video-src*=http]");
|
||||
const purl = pvideo[0].attribs['video-src'];
|
||||
// console.debug('兔小贝 purl =====>' + purl); // js_debug.log
|
||||
return JSON.stringify({
|
||||
parse: 0,
|
||||
url: purl,
|
||||
});
|
||||
}
|
||||
|
||||
async function search(wd, quick) {
|
||||
const link = HOST + "/search/" + wd;
|
||||
const html = await request(link);
|
||||
const $ = load(html);
|
||||
const list = $("div.list-con > div.items");
|
||||
let videos = _.map(list, (it) => {
|
||||
const a = $(it).find("a:first")[0];
|
||||
const img = $(it).find("mip-img:first")[0];
|
||||
const tt = $(it).find("p:first")[0];
|
||||
const remarks = $(it).find("p")[1];
|
||||
return {
|
||||
vod_id: a.attribs.href.replace(/.*?\/play\/(.*)/g, '$1'),
|
||||
vod_name: tt.children[0].data,
|
||||
vod_pic: img.attribs["src"],
|
||||
vod_remarks: remarks.children[0].data || "",
|
||||
};
|
||||
});
|
||||
return JSON.stringify({
|
||||
list: videos,
|
||||
land: 1,
|
||||
ratio: 1.78,
|
||||
});
|
||||
}
|
||||
|
||||
export function __jsEvalReturn() {
|
||||
return {
|
||||
init: init,
|
||||
home: home,
|
||||
homeVod: homeVod,
|
||||
category: category,
|
||||
detail: detail,
|
||||
play: play,
|
||||
search: search,
|
||||
}
|
||||
}
|
@ -1,118 +0,0 @@
|
||||
// 无搜索功能
|
||||
import { _ } from './lib/cat.js';
|
||||
let key = '🐯贝乐虎';
|
||||
let HOST = 'https://vd.ubestkid.com';
|
||||
let siteKey = '';
|
||||
let siteType = 0;
|
||||
const MOBILE_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, referer, mth, data, hd) {
|
||||
const headers = {
|
||||
"User-Agent": MOBILE_UA,
|
||||
};
|
||||
if (referer) headers.referer = encodeURIComponent(referer);
|
||||
let res = await req(reqUrl, {
|
||||
method: mth || "get",
|
||||
headers: headers,
|
||||
data: data,
|
||||
postType: mth === "post" ? "json" : "",
|
||||
});
|
||||
return res.content;
|
||||
}
|
||||
|
||||
async function init(cfg) {
|
||||
siteKey = cfg.skey;
|
||||
siteType = cfg.stype
|
||||
}
|
||||
|
||||
async function home(filter) {
|
||||
const classes = [{ type_id: 65, type_name: '🐯最新上架' }, { type_id: 113, type_name: '🐯人气热播' }, { type_id: 56, type_name: '🐯经典童谣' }, { type_id: 137, type_name: '🐯开心贝乐虎' }, { type_id: 53, type_name: '🐯律动儿歌' }, { type_id: 59, type_name: '🐯经典儿歌' }, { type_id: 101, type_name: '🐯超级汽车1' }, { type_id: 119, type_name: '🐯超级汽车第二季' }, { type_id: 136, type_name: '🐯超级汽车第三季' }, { type_id: 95, type_name: '🐯三字经' }, { type_id: 133, type_name: '🐯幼儿手势舞' }, { type_id: 117, type_name: '🐯哄睡儿歌' }, { type_id: 70, type_name: '🐯英文儿歌' }, { type_id: 116, type_name: '🐯节日与节气' }, { type_id: 97, type_name: '🐯恐龙世界' }, { type_id: 55, type_name: '🐯动画片儿歌' }, { type_id: 57, type_name: '🐯流行歌曲' }, { type_id: 118, type_name: '🐯贝乐虎入园记' }, { type_id: 106, type_name: '🐯贝乐虎大百科' }, { type_id: 62, type_name: '🐯经典古诗' }, { type_id: 63, type_name: '🐯经典故事' }, { type_id: 128, type_name: '🐯萌虎学功夫' }, { type_id: 100, type_name: '🐯绘本故事' }, { type_id: 121, type_name: '🐯开心贝乐虎英文版' }, { type_id: 96, type_name: '🐯嗨贝乐虎情商动画' }, { type_id: 108, type_name: '🐯动物音乐派对' }, { type_id: 126, type_name: '🐯动物音乐派对英文版' }, { type_id: 105, type_name: '🐯奇妙的身体' }, { type_id: 124, type_name: '🐯奇妙的身体英文版' }, { type_id: 64, type_name: '🐯认知卡片' }, { type_id: 109, type_name: '🐯趣味简笔画' }, { type_id: 78, type_name: '🐯数字儿歌' }, { type_id: 120, type_name: '🐯识字体验版' }, { type_id: 127, type_name: '🐯启蒙系列体验版' }];
|
||||
const filterObj = {};
|
||||
return JSON.stringify({
|
||||
class: _.map(classes, (cls) => {
|
||||
cls.land = 1;
|
||||
cls.ratio = 1.78;
|
||||
return cls;
|
||||
}),
|
||||
filters: filterObj,
|
||||
})
|
||||
}
|
||||
|
||||
async function homeVod() {
|
||||
const link = HOST + "/api/v1/bv/video";
|
||||
const pdata = { age: 1, appver: "6.1.9", egvip_status: 0, svip_status: 0, vps: 60, subcateId: 56, "p": 1 };
|
||||
const jo = JSON.parse(await request(link, "", "post", pdata)).result;
|
||||
const videos = [];
|
||||
_.each(jo.items, (it) => {
|
||||
videos.push({
|
||||
vod_id: it.url,
|
||||
vod_name: it.title,
|
||||
vod_pic: it.image,
|
||||
vod_remarks: '👀' + it.viewcount || '',
|
||||
})
|
||||
});
|
||||
return JSON.stringify({
|
||||
list: videos,
|
||||
})
|
||||
}
|
||||
|
||||
async function category(tid, pg, filter, extend) {
|
||||
if (pg <= 0 || typeof pg == 'undefined') pg = 1;
|
||||
const link = HOST + "/api/v1/bv/video";
|
||||
const pdata = { age: 1, appver: "6.1.9", egvip_status: 0, svip_status: 0, vps: 60, subcateId: tid, "p": pg };
|
||||
const jo = JSON.parse(await request(link, "", "post", pdata)).result;
|
||||
const videos = [];
|
||||
_.each(jo.items, (it) => {
|
||||
videos.push({
|
||||
vod_id: it.url,
|
||||
vod_name: it.title,
|
||||
vod_pic: it.image,
|
||||
vod_remarks: '👀' + it.viewcount || '',
|
||||
})
|
||||
});
|
||||
const pgCount = pg * 60 > jo.total ? parseInt(pg) : parseInt(pg) + 1;
|
||||
return JSON.stringify({
|
||||
page: parseInt(pg),
|
||||
pagecount: pgCount,
|
||||
limit: 60,
|
||||
total: jo.total,
|
||||
list: videos,
|
||||
})
|
||||
}
|
||||
|
||||
async function detail(id) {
|
||||
const vod = {
|
||||
vod_id: id,
|
||||
vod_remarks: '',
|
||||
};
|
||||
const playlist = ['点击播放' + '$' + id];
|
||||
vod.vod_play_from = "道长在线";
|
||||
vod.vod_play_url = playlist.join('#');
|
||||
return JSON.stringify({
|
||||
list: [vod],
|
||||
});
|
||||
}
|
||||
|
||||
async function play(flag, id, flags) {
|
||||
// console.debug('贝乐虎 id =====>' + id); // js_debug.log
|
||||
return JSON.stringify({
|
||||
parse: 0,
|
||||
url: id,
|
||||
});
|
||||
}
|
||||
|
||||
async function search(wd, quick) {
|
||||
return '{}'
|
||||
}
|
||||
|
||||
export function __jsEvalReturn() {
|
||||
return {
|
||||
init: init,
|
||||
home: home,
|
||||
homeVod: homeVod,
|
||||
category: category,
|
||||
detail: detail,
|
||||
play: play,
|
||||
search: search,
|
||||
}
|
||||
}
|
@ -1 +0,0 @@
|
||||
function isSub(ext){return"srt"==ext||"ass"==ext||"ssa"==ext}function getSize(size){return size<=0?"":1099511627776<size?(size/=1099511627776).toFixed(2)+"TB":1073741824<size?(size/=1073741824).toFixed(2)+"GB":1048576<size?(size/=1048576).toFixed(2)+"MB":(size/=1024).toFixed(2)+"KB"}function removeExt(text){return-1<text.indexOf(".")?text.substring(0,text.lastIndexOf(".")):text}async function log(str){}export{isSub,getSize,removeExt,log};
|
258
lib/zxzj_open.js
258
lib/zxzj_open.js
@ -1,258 +0,0 @@
|
||||
// 自动从 地址发布页 获取&跳转url地址
|
||||
import { Crypto, load, _ } from './lib/cat.js';
|
||||
|
||||
let key = '在线之家';
|
||||
let HOST = 'https://www.zxzj.site'; // 地址发布页
|
||||
let host = '';
|
||||
let siteKey = '';
|
||||
let siteType = 0;
|
||||
|
||||
const MOBILE_UA = 'Mozilla/5.0 (Linux; Android 11; M2007J3SC Build/RKQ1.200826.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045714 Mobile Safari/537.36';
|
||||
|
||||
async function request(reqUrl, agentSp) {
|
||||
let res = await req(reqUrl, {
|
||||
method: 'get',
|
||||
headers: {
|
||||
'User-Agent': agentSp || MOBILE_UA,
|
||||
'Referer': host
|
||||
},
|
||||
});
|
||||
return res.content;
|
||||
}
|
||||
|
||||
// cfg = {skey: siteKey, ext: extend}
|
||||
async function init(cfg) {
|
||||
siteKey = cfg.skey;
|
||||
siteType = cfg.stype;
|
||||
const html = await request(HOST);
|
||||
const $ = load(html);
|
||||
host = $('div.content-top > ul > li').find('a:first')[0].attribs.href;
|
||||
console.debug('在线之家 跳转地址 =====>' + host); // js_debug.log
|
||||
}
|
||||
|
||||
async function home(filter) {
|
||||
const html = await request(host);
|
||||
const $ = load(html);
|
||||
const class_parse = $('ul.stui-header__menu > li > a[href*=list]');
|
||||
let 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,
|
||||
};
|
||||
});
|
||||
const filterObj = {
|
||||
1: [{ 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: '冒险' }] }, { 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: '其他' }] }],
|
||||
2: [{ 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: '其他' }] }],
|
||||
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: '其他' }] }],
|
||||
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: '其他' }] }],
|
||||
6: [{ 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: '其他' }] }]
|
||||
};
|
||||
let filYer = { 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' }, { n: '2016', v: '2016' }, { n: '2015', v: '2015' }, { n: '2014', v: '2014' }, { n: '2013', v: '2013' }, { n: '2012', v: '2012' }, { n: '2011', v: '2011' }] };
|
||||
filYer['init'] = filYer.value[0].v;
|
||||
let filBy = { key: 'by', name: '排序', value: [{ n: '时间', v: 'time' }, { n: '人气', v: 'hits' }, { n: '评分', v: 'score' }] };
|
||||
filBy['init'] = filBy.value[0].v;
|
||||
return JSON.stringify({
|
||||
class: _.map(classes, (cls) => {
|
||||
if (filterObj[cls.type_id]) {
|
||||
filterObj[cls.type_id].push(filYer, filBy);
|
||||
filterObj[cls.type_id][0]['init'] = filterObj[cls.type_id][0].value[0].v;
|
||||
} else {
|
||||
filterObj[cls.type_id] = [];
|
||||
filterObj[cls.type_id].push(filYer, filBy)
|
||||
}
|
||||
return cls;
|
||||
}),
|
||||
filters: filterObj,
|
||||
});
|
||||
}
|
||||
|
||||
async function homeVod() {
|
||||
const link = host + '/vodshow/1--hits---------2023.html';
|
||||
const html = await request(link);
|
||||
const $ = load(html);
|
||||
const js2Base = await js2Proxy(true, siteType, siteKey, 'img/', {});
|
||||
const items = $('ul.stui-vodlist > li');
|
||||
let videos = _.map(items, (item) => {
|
||||
const a = $(item).find('a:first')[0];
|
||||
const remarks = $($(item).find('span.pic-text')[0]).text().trim();
|
||||
return {
|
||||
vod_id: a.attribs.href.replace(/.*?\/detail\/(.*).html/g, '$1'),
|
||||
vod_name: a.attribs.title,
|
||||
vod_pic: js2Base + base64Encode(a.attribs['data-original']),
|
||||
vod_remarks: remarks || '',
|
||||
};
|
||||
});
|
||||
return JSON.stringify({
|
||||
list: videos,
|
||||
});
|
||||
}
|
||||
|
||||
async function category(tid, pg, filter, extend) {
|
||||
if (pg <= 0 || typeof (pg) == 'undefined') pg = 1;
|
||||
const link = host + '/vodshow/' + 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 js2Base = await js2Proxy(true, siteType, siteKey, 'img/', {});
|
||||
const items = $('ul.stui-vodlist > li');
|
||||
let videos = _.map(items, (item) => {
|
||||
const a = $(item).find('a:first')[0];
|
||||
const remarks = $($(item).find('span.pic-text')[0]).text().trim();
|
||||
return {
|
||||
vod_id: a.attribs.href.replace(/.*?\/detail\/(.*).html/g, '$1'),
|
||||
vod_name: a.attribs.title,
|
||||
vod_pic: js2Base + base64Encode(a.attribs['data-original']),
|
||||
vod_remarks: remarks || '',
|
||||
};
|
||||
});
|
||||
const hasMore = $('ul.stui-page__item > 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(host + '/detail/' + id + '.html');
|
||||
const $ = load(html);
|
||||
const js2Base = await js2Proxy(true, siteType, siteKey, 'img/', {});
|
||||
const vod = {
|
||||
vod_id: id,
|
||||
vod_name: $('h1:first').text().trim(),
|
||||
vod_type: $('.stui-content__detail p:first a').text(),
|
||||
vod_actor: $('.stui-content__detail p:nth-child(3)').text().replace('主演:', ''),
|
||||
vod_director: $('.stui-content__detail p:nth-child(4)').text().replace('导演:', ''),
|
||||
vod_pic: js2Base + base64Encode($('.stui-content__thumb img:first').attr('data-original')),
|
||||
vod_remarks: $('.stui-content__detail p:nth-child(5)').text() || '',
|
||||
vod_content: $('span.detail-content').text().trim(),
|
||||
};
|
||||
let playMap = {};
|
||||
const tabs = $('div.stui-vodlist__head > h3');
|
||||
const playlists = $('ul.stui-content__playlist');
|
||||
_.each(tabs, (tab, i) => {
|
||||
const from = tab.children[0].data;
|
||||
let list = playlists[i];
|
||||
list = $(list).find('a');
|
||||
_.each(list, (it) => {
|
||||
const title = it.children[0].data;
|
||||
const playUrl = it.attribs.href;
|
||||
if (title.length == 0) title = it.children[0].data.trim();
|
||||
if (!playMap.hasOwnProperty(from)) {
|
||||
playMap[from] = [];
|
||||
}
|
||||
playMap[from].push(title + '$' + playUrl);
|
||||
});
|
||||
});
|
||||
vod.vod_play_from = _.keys(playMap).join('$$$');
|
||||
const urls = _.values(playMap);
|
||||
let vod_play_url = _.map(urls, (urlist) => {
|
||||
return urlist.join('#');
|
||||
});
|
||||
vod.vod_play_url = vod_play_url.join('$$$');
|
||||
return JSON.stringify({
|
||||
list: [vod],
|
||||
});
|
||||
}
|
||||
|
||||
async function play(flag, id, flags) {
|
||||
const html = await request(host + id);
|
||||
const mhtml = html.match(/r player_.*?=(.*?)</)[1];
|
||||
const json = JSON.parse(mhtml);
|
||||
const url = json.url;
|
||||
const from = json.from;
|
||||
if (json.encrypt == '1') {
|
||||
url = unescape(url)
|
||||
} else if (json.encrypt == '2') {
|
||||
url = unescape(base64Decode(url))
|
||||
}
|
||||
if (url.indexOf('m3u8') >= 0 || url.indexOf('mp4') >= 0) {
|
||||
// console.debug('在线之家url =====>' + url); // js_debug.log
|
||||
return JSON.stringify({
|
||||
parse: 0,
|
||||
url: url,
|
||||
});
|
||||
} else if (from.indexOf('line3') >= 0 || from.indexOf('line5') >= 0) {
|
||||
const ifrwy = await request(url);
|
||||
const code = ifrwy.match(/var url = '(.*?)'/)[1].split('').reverse().join('');
|
||||
let temp = '';
|
||||
for (let i = 0x0; i < code.length; i = i + 0x2) {
|
||||
temp += String.fromCharCode(parseInt(code[i] + code[i + 0x1], 0x10))
|
||||
}
|
||||
const purl = temp.substring(0x0, (temp.length - 0x7) / 0x2) + temp.substring((temp.length - 0x7) / 0x2 + 0x7);
|
||||
// console.debug('在线之家purl =====>' + purl); // js_debug.log
|
||||
return JSON.stringify({
|
||||
parse: 0,
|
||||
url: purl,
|
||||
});
|
||||
} else {
|
||||
// console.debug('在线之家url =====>' + '空'); // js_debug.log
|
||||
return '{}';
|
||||
}
|
||||
}
|
||||
|
||||
async function search(wd, quick) {
|
||||
var data = JSON.parse(await request(host + '/index.php/ajax/suggest?mid=1&wd=' + wd + '&limit=50')).list;
|
||||
const js2Base = await js2Proxy(true, siteType, siteKey, 'img/', {});
|
||||
let videos = _.map(data, (it) => {
|
||||
return {
|
||||
vod_id: it.id,
|
||||
vod_name: it.name,
|
||||
vod_pic: js2Base + base64Encode(it.pic),
|
||||
vod_remarks: '',
|
||||
}
|
||||
});
|
||||
return JSON.stringify({
|
||||
list: videos,
|
||||
limit: 50,
|
||||
});
|
||||
}
|
||||
|
||||
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: 'https://api.douban.com/',
|
||||
'User-Agent': MOBILE_UA,
|
||||
},
|
||||
});
|
||||
return JSON.stringify({
|
||||
code: resp.code,
|
||||
buffer: 2,
|
||||
content: resp.content,
|
||||
headers: resp.headers,
|
||||
});
|
||||
}
|
||||
return JSON.stringify({
|
||||
code: 500,
|
||||
content: '',
|
||||
});
|
||||
}
|
||||
|
||||
export function __jsEvalReturn() {
|
||||
return {
|
||||
init: init,
|
||||
home: home,
|
||||
homeVod: homeVod,
|
||||
category: category,
|
||||
detail: detail,
|
||||
play: play,
|
||||
proxy: proxy,
|
||||
search: search,
|
||||
};
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user