This commit is contained in:
he 2024-02-12 08:15:21 +08:00
parent 4e69f9a945
commit 29f5804fd1
261 changed files with 96963 additions and 186 deletions

580
5/0/0.json Normal file
View File

@ -0,0 +1,580 @@
{
"spider": "./cc.jar;md5;63f50337d37d87c6a3b61d81375fc378",
"lives": [
{
"name": "tvlive",
"type": 0,
"url": "./lib/tvlive.txt",
"playerType": 2
},
{
"name": "嗅探",
"ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0",
"type": 0,
"url": "https://mirror.ghproxy.com/https://raw.githubusercontent.com/dxawi/0/main/xiutan.m3u"
}
],
"sites": [
{
"key": "豆瓣推荐",
"name": "豆瓣推荐",
"type": 3,
"api": "csp_DouDou",
"searchable": 0,
"quickSearch": 0,
"filterable": 0
},
{
"key": "南瓜",
"name": "南瓜",
"type": 3,
"api": "csp_NanGua",
"playerType": 2,
"searchable": 1,
"quickSearch": 1,
"changeable": 1
},
{
"key": "csp_WoGG",
"name": "玩偶哥哥(饭太硬)",
"type": 3,
"api": "csp_WoGG",
"searchable": 1,
"quickSearch": 1,
"changeable": 0,
"ext": "http://127.0.0.1:9978/file/tvbox/6420d2e6-6b07-425d-9e36-a1b1bc0542a2/token.txt"
},
{
"key": "Czsapp",
"name": "厂长",
"type": 3,
"api": "csp_Czsapp",
"playerType": 2,
"searchable": 1,
"quickSearch": 1,
"changeable": 1,
"ext": "https://www.czzy55.com/"
},
{
"key": "Xinsj",
"name": "新视觉",
"type": 3,
"api": "csp_Xinsj",
"searchable": 1,
"quickSearch": 1,
"changeable": 1,
"ext": "https://www.hdmyy.com/"
},
{
"key": "369",
"name": "369",
"type": 3,
"api": "csp_Cs1369",
"playerType": 2,
"searchable": 1,
"quickSearch": 1,
"changeable": 1
},
{
"key": "一起看 ",
"name": "一起看",
"type": 3,
"api": "csp_YQKan",
"searchable": 1,
"quickSearch": 1,
"changeable": 1
},
{
"key": "77",
"name": "七七",
"type": 3,
"api": "csp_Kunyu77",
"searchable": 1,
"quickSearch": 1,
"changeable": 1
},
{
"key": "新6V",
"name": "新6V磁力",
"type": 3,
"api": "csp_SixV",
"searchable": 1,
"quickSearch": 1,
"changeable": 0,
"ext": "http://www.xb6v.com/"
},
{
"key": "农民",
"name": "农民",
"type": 3,
"api": "csp_Nmys",
"searchable": 1,
"quickSearch": 1,
"changeable": 1,
"ext": "./lib/nmys.json"
},
{
"key": "荐片",
"name": "荐片[js]",
"type": 3,
"searchable": 1,
"quickSearch": 1,
"changeable": 1,
"playerType": "1",
"api": "./lib/drpy2.min.js",
"ext": "./lib/jp.js"
},
{
"key": "drpy_js_量子资源",
"name": "量子[js]",
"type": 3,
"api": "./lib/drpy2.min.js",
"ext": "./lib/量子资源.js"
},
{
"key": "鑫鑫[V2]",
"name": "鑫鑫[V2][js]",
"type": 3,
"api": "./lib/drpy2.min.js",
"ext": "./lib/鑫鑫[V2].js"
},
{
"key": "北极狐[V2]",
"name": "北极狐[V2][js]",
"type": 3,
"api": "./lib/drpy2.min.js",
"ext": "./lib/北极狐[V2].js"
},
{
"key": "ikanbot3",
"name": "ikanbot3[js]",
"type": 3,
"api": "./lib/drpy2.min.js",
"ext": "./lib/ikanbot3.js"
},
{
"key": "drpy_js_玄天",
"name": "玄天[js]",
"type": 3,
"api": "./lib/drpy2.min.js",
"ext": "./lib/玄天.js"
},
{
"key": "drpy_js_爱看",
"name": "爱看[js]",
"type": 3,
"api": "./lib/drpy2.min.js",
"ext": "./lib/爱看.js"
},
{
"key": "新视觉js",
"name": "新视觉[js]",
"type": 3,
"api": "./lib/drpy2.min.js",
"ext": "./lib/新视觉影视.js"
},
{
"key": "csp_Bttoo",
"name": "Bttwoo",
"type": 3,
"api": "csp_Bttwoo",
"searchable": 1,
"quickSearch": 1,
"changeable": 1
},
{
"key": "Lib",
"name": "Lib",
"type": 3,
"api": "csp_Libvio",
"searchable": 1,
"quickSearch": 1,
"changeable": 1,
"ext": "https://www.libvio.pro/"
},
{
"key": "DiDuan",
"name": "低端",
"type": 3,
"api": "csp_Ddrk",
"playerType": "2",
"searchable": 1,
"quickSearch": 1,
"changeable": 1
},
{
"key": "kkys",
"name": "快看[cat]",
"type": 3,
"api": "./lib/kkys_open.js"
},
{
"key": "wobg",
"name": "玩偶表[cat]",
"type": 3,
"api": "./lib/wobg_open.js",
"ext": "http://127.0.0.1:9978/file/tvfan/token.json"
},
{
"key": "ysc",
"name": "影视车[cat]",
"type": 3,
"api": "./lib/ysc_open.js",
"ext": "http://127.0.0.1:9978/file/tvfan/token.json"
},
{
"key": "ggys_open",
"name": "高光[cat]",
"type": 3,
"api": "./lib/ggys_open.js"
},
{
"key": "猫农民",
"name": "农民[cat]",
"type": 3,
"api": "./lib/猫农民.js"
},
{
"key": "猫南瓜",
"name": "南瓜[cat]",
"type": 3,
"api": "./lib/猫南瓜.js"
},
{
"key": "555",
"name": "三五[cat]",
"type": 3,
"api": "./lib/555dy_open.js"
},
{
"key": "cntv",
"name": "央视[cat]",
"type": 3,
"api": "./lib/cntv_open.js"
},
{
"key": "230ts",
"name": "爱上你听书网[cat]",
"type": 3,
"api": "./lib/230ts_open.js"
},
{
"key": "bookan_book_open",
"name": "Bookan[cat]",
"type": 3,
"api": "./lib/MyCatBookan.js"
},
{
"key": "boosj_open",
"name": "童趣[cat]",
"type": 3,
"api": "./lib/boosj_open.js"
},
{
"key": "tuxiaobei_open",
"name": "兔小贝[cat]",
"type": 3,
"api": "./lib/tuxiaobei_open.js"
},
{
"key": "ubestkid_open",
"name": "贝乐虎[cat]",
"type": 3,
"api": "./lib/ubestkid_open.js"
},
{
"key": "腐宅",
"name": "腐宅",
"type": 3,
"api": "csp_AppYsV2",
"searchable": 1,
"quickSearch": 1,
"filterable": 1,
"changeable": 0,
"ext": "http://app.zhaifutvapp.com/ruifenglb_api.php/v1.vod"
},
{
"key": "暴风",
"name": "暴风",
"type": 1,
"api": "https://bfzyapi.com/api.php/provide/vod",
"searchable": 1,
"changeable": 1
},
{
"key": "七夜",
"name": "七夜(阿里搜索)",
"type": 3,
"api": "csp_Dovx",
"searchable": 1,
"quickSearch": 1,
"filterable": 0,
"changeable": 0,
"ext": "http://127.0.0.1:9978/file/tvbox/6420d2e6-6b07-425d-9e36-a1b1bc0542a2/token.txt"
},
{
"key": "YiSo",
"name": "一搜(阿里搜索)",
"type": 3,
"api": "csp_YiSo",
"searchable": 1,
"quickSearch": 1,
"filterable": 0,
"changeable": 0,
"ext": "http://127.0.0.1:9978/file/tvbox/6420d2e6-6b07-425d-9e36-a1b1bc0542a2/token.txt"
},
{
"key": "UpYun",
"name": "云搜(阿里搜索)",
"type": 3,
"api": "csp_UpYun",
"searchable": 1,
"quickSearch": 1,
"filterable": 0,
"changeable": 0,
"ext": "http://127.0.0.1:9978/file/tvbox/6420d2e6-6b07-425d-9e36-a1b1bc0542a2/token.txt"
},
{
"key": "PanSearch",
"name": "盘搜索(阿里搜索)",
"type": 3,
"api": "csp_PanSearch",
"searchable": 1,
"quickSearch": 1,
"filterable": 0,
"changeable": 0,
"ext": "http://127.0.0.1:9978/file/tvbox/6420d2e6-6b07-425d-9e36-a1b1bc0542a2/token.txt"
},
{
"key": "push_agent",
"name": "推送",
"type": 3,
"api": "csp_Push",
"searchable": 0,
"quickSearch": 0,
"filterable": 0,
"ext": "http://127.0.0.1:9978/file/tvbox/6420d2e6-6b07-425d-9e36-a1b1bc0542a2/token.txt"
},
{
"key": "bili_open",
"name": "哔哩貓",
"type": 3,
"api": "./lib/bili_open.js",
"searchable": 1,
"changeable": 0,
"ext": {
"categories": "短剧#沙雕动画#沙雕穿越#沙雕",
"cookie": ""
}
},
{
"key": "csp_Nbys",
"name": "泥视频(墙外)",
"type": 3,
"api": "csp_NiNi",
"searchable": 1,
"quickSearch": 1,
"filterable": 1
},
{
"key": "Bili",
"name": "Bili",
"type": 3,
"api": "csp_Bili",
"style": {
"type": "rect",
"ratio": 1.597
},
"searchable": 1,
"quickSearch": 0,
"changeable": 0,
"ext": "./lib/bilibili.json"
},
{
"key": "课堂教育",
"name": "课堂教育",
"type": 3,
"api": "csp_Bili",
"searchable": 0,
"quickSearch": 0,
"filterable": 1,
"ext": "./lib/xx1.json"
},
{
"key": "少儿教育",
"name": "少儿教育",
"type": 3,
"api": "csp_Bili",
"searchable": 0,
"quickSearch": 0,
"filterable": 1,
"ext": "./lib/xx2.json"
},
{
"key": "小学教育",
"name": "小学教育",
"type": 3,
"api": "csp_Bili",
"searchable": 0,
"quickSearch": 0,
"filterable": 1,
"ext": "./lib/xx3.json"
},
{
"key": "初中教育",
"name": "初中教育",
"type": 3,
"api": "csp_Bili",
"searchable": 0,
"quickSearch": 0,
"filterable": 1,
"ext": "./lib/xx4.json"
},
{
"key": "高中教育",
"name": "高中教育",
"type": 3,
"api": "csp_Bili",
"searchable": 0,
"quickSearch": 0,
"filterable": 1,
"ext": "./lib/xx5.json"
}
],
"rules": [
{
"name": "proxy",
"hosts": [
"raw.githubusercontent.com",
"googlevideo.com",
"cdn.v82u1l.com",
"cdn.iz8qkg.com",
"cdn.kin6c1.com",
"c.biggggg.com",
"c.olddddd.com",
"haiwaikan.com",
"www.histar.tv",
"youtube.com",
"uhibo.com",
".*boku.*",
".*nivod.*",
".*ulivetv.*"
]
},
{
"name": "海外看",
"hosts": [
"haiwaikan"
],
"regex": [
"8.1748",
"10.0099",
"10.3333",
"16.0599"
]
},
{
"name": "暴風",
"hosts": [
"bfzy"
],
"regex": [
"#EXT-X-DISCONTINUITY\\r*\\n*#EXTINF:3,[\\s\\S]*?#EXT-X-DISCONTINUITY"
]
},
{
"name": "星星",
"hosts": [
"aws.ulivetv.net"
],
"regex": [
"#EXT-X-DISCONTINUITY\\r*\\n*#EXTINF:8,[\\s\\S]*?#EXT-X-DISCONTINUITY"
]
},
{
"name": "量子",
"hosts": [
"vip.lz",
"hd.lz",
"v.cdnlz"
],
"regex": [
"#EXT-X-DISCONTINUITY\\r*\\n*#EXTINF:6.433333,[\\s\\S]*?#EXT-X-DISCONTINUITY",
"#EXTINF.*?\\s+.*?1o.*?\\.ts\\s+"
]
},
{
"name": "非凡",
"hosts": [
"vip.ffzy",
"hd.ffzy"
],
"regex": [
"25.0666"
]
},
{
"name": "火山嗅探",
"hosts": [
"huoshan.com"
],
"regex": [
"item_id="
]
},
{
"name": "蚂蚁",
"hosts": [
"v.cdnlz1.com"
],
"regex": [
"#EXT-X-DISCONTINUITY\\r*\\n*#EXTINF:6.666667,[\\s\\S]*?#EXT-X-DISCONTINUITY"
]
},
{
"name": "索尼",
"hosts": [
"suonizy"
],
"regex": [
"15.1666"
]
},
{
"name": "一起看",
"hosts": [
"yqk88"
],
"regex": [
"18.4666"
]
},
{
"name": "一起看",
"hosts": [
"yqk88"
],
"regex": [
"15.1666"
]
},
{
"name": "抖音嗅探",
"hosts": [
"douyin.com"
],
"regex": [
"is_play_url="
]
},
{
"name": "農民嗅探",
"hosts": [
"toutiaovod.com"
],
"regex": [
"video/tos/cn"
]
}
]
}

BIN
5/0/cc.jar Normal file

Binary file not shown.

2
5/0/k配置地址.txt Normal file
View File

@ -0,0 +1,2 @@
dxawi接口精简接口
https://dxawi.github.io/0/0.json

253
5/0/lib/230ts_open.js Normal file
View 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,
};
}

1
5/0/lib/555dy_open.js Normal file

File diff suppressed because one or more lines are too long

137
5/0/lib/MyCatBookan.js Normal file
View File

@ -0,0 +1,137 @@
import { _ } from './lib/cat.js';
let key = 'bookan';
let url = 'https://api.bookan.com.cn';
let siteKey = '';
let siteType = 0;
async function request(reqUrl, agentSp) {
let res = await req(reqUrl, {
method: 'get',
});
return res.content;
}
// cfg = {skey: siteKey, ext: extend}
async function init(cfg) {
siteKey = cfg.skey;
siteType = cfg.stype;
}
async function home(filter) {
return JSON.stringify({
class: [
{ type_id: '1305', type_name: '少年读物' },
{ type_id: '1304', type_name: '儿童文学' },
{ type_id: '1320', type_name: '国学经典' },
{ type_id: '1306', type_name: '文艺少年' },
{ type_id: '1309', type_name: '育儿心经' },
{ type_id: '1310', type_name: '心理哲学' },
{ type_id: '1307', type_name: '青春励志' },
{ type_id: '1312', type_name: '历史小说' },
{ type_id: '1303', type_name: '故事会' },
{ type_id: '1317', type_name: '音乐戏剧' },
{ type_id: '1319', type_name: '相声评书' },
],
});
}
async function category(tid, pg, filter, extend) {
pg = pg || 1;
if (pg == 0) pg = 1;
let content = await request(`${url}/voice/book/list?instance_id=25304&page=${pg}&category_id=${tid}&num=24`);
let data = JSON.parse(content).data;
let books = [];
for (const book of data.list) {
books.push({
vod_id: book.id,
vod_name: book.name,
vod_pic: book.cover,
vod_remarks: book.extra.author,
});
}
return JSON.stringify({
page: data.current_page,
pagecount: data.last_page,
limit: 24,
total: data.total,
list: books,
});
}
async function detail(id) {
let content = await request(`${url}/voice/album/units?album_id=${id}&page=1&num=200&order=1`);
let data = JSON.parse(content).data;
console.log(JSON.stringify(data));
let book = {
vod_id: id,
type_name: '',
vod_year: '',
vod_area: '',
vod_remarks: '',
vod_actor: '',
vod_director: '',
vod_content: '',
};
let us = _.map(data.list, function (b) {
return formatPlayUrl(b.title) + '$' + b.file;
}).join('#');
book.vod_play_from = '书卷';
book.vod_play_url = us;
return JSON.stringify({
list: [book],
});
}
function formatPlayUrl(name) {
return name
.trim()
.replace(/<|>|\.《.*?》/g, '. ')
.replace(/\$|#/g, ' ')
.trim();
}
async function proxy(segments, headers) {}
async function play(flag, id, flags) {
return JSON.stringify({
parse: 0,
url: id,
});
}
async function search(wd, quick, pg) {
pg = pg || 1;
if (pg == 0) pg = 1;
let content = await request(`https://es.bookan.com.cn/api/v3/voice/book?instanceId=25304&keyword=${wd}&pageNum=${pg}&limitNum=20`);
let data = JSON.parse(content).data;
let books = [];
for (const book of data.list) {
books.push({
vod_id: book.id,
vod_name: book.name,
vod_pic: book.cover,
vod_remarks: book.extra.author,
});
}
return JSON.stringify({
page: data.current_page,
pagecount: data.last_page,
limit: 20,
total: data.total,
list: books,
});
}
export function __jsEvalReturn() {
return {
init: init,
home: home,
category: category,
detail: detail,
play: play,
search: search,
};
}

621
5/0/lib/bili_open.js Normal file
View File

@ -0,0 +1,621 @@
import { Crypto, jinja2, _ } from 'assets://js/lib/cat.js';
let siteKey = '';
let siteType = 0;
let cookie = '';
let login = '';
let vip = false;
let extendObj = {};
let bili_jct = '';
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, buffer) {
let res = await req(reqUrl, {
method: 'get',
headers: ua ? ua : { 'User-Agent': UA },
timeout: 60000,
buffer: buffer ? 1 : 0,
});
return res.content;
}
async function post(reqUrl, postData, ua, posttype) {
let res = await req(reqUrl, {
method: 'post',
headers: ua ? ua : { 'User-Agent': UA },
data: postData,
timeout: 60000,
postType: posttype,
});
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;
// 获取csrf
const cookies = cookie.split(';');
cookies.forEach(cookie => {
if (cookie.includes('bili_jct')) {
bili_jct = cookie.split('=')[1];
}
});
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.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 = {};
const sc = {
type_name: "首页",
type_id: "首页",
land: 1,
ratio: 1.33,
}
newarr.push(sc);
for (const kk of ext) {
const c = {
type_name: kk,
type_id: kk,
land: 1,
ratio: 1.33,
};
newarr.push(c);
d[kk] = jsonData;
}
if (!_.isEmpty(bili_jct)) {
const hc = {
type_name: "历史记录",
type_id: "历史记录",
land: 1,
ratio: 1.33,
}
newarr.push(hc);
}
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 url = 'https://api.bilibili.com/x/web-interface/index/top/rcmd?ps=14&fresh_idx=1&fresh_idx_1h=1';
const response = await request(url, getHeaders());
const responseData = JSON.parse(response);
const vods = responseData.data.item;
for (const item of vods) {
const vod = {};
let imageUrl = item.pic;
if (imageUrl.startsWith('//')) {
imageUrl = 'https:' + imageUrl;
}
let cd = getFullTime(item.duration);
vod.vod_id = item.bvid;
vod.vod_name = removeTags(item.title);
vod.vod_pic = imageUrl;
vod.vod_remarks = cd;
vod.style = {
type: 'rect',
ratio: 1.33,
},
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 = '';
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)}`;
if (tid == "首页") {
url = "https://api.bilibili.com/x/web-interface/index/top/rcmd?ps=14&fresh_idx=" + page + "&fresh_idx_1h=" + page;
} else if (tid == "历史记录") {
url = "https://api.bilibili.com/x/v2/history?pn=" + page;
}
const data = JSON.parse(await request(url, getHeaders())).data;
let items = data.result;
if (tid == "首页") {
items = data.item;
} else if (tid == "历史记录") {
items = data;
}
const videos = [];
for (const item of items) {
const video = {};
let pic = item.pic;
if (pic.startsWith('//')) {
pic = 'https:' + pic;
}
let cd = getFullTime(item.duration);
video.vod_remarks = cd;
video.vod_id = item.bvid;
video.vod_name = removeTags(item.title);
video.vod_pic = pic;
video.style = {
type: 'rect',
ratio: 1.33,
},
videos.push(video);
}
const result = {
page: page,
pagecount: data.numPages ?? (page + 1),
limit: videos.length,
total: videos.length * (page + 1),
list: videos,
};
return JSON.stringify(result);
} catch (e) { }
return null;
}
async function detail(ids) {
try {
const bvid = ids;
const detailUrl = `https://api.bilibili.com/x/web-interface/view?bvid=${bvid}`;
const detailData = JSON.parse(await request(detailUrl, getHeaders())).data;
// 记录历史
if (!_.isEmpty(bili_jct)) {
const historyReport = 'https://api.bilibili.com/x/v2/history/report';
let dataPost = {
aid: detailData.aid,
cid: detailData.cid,
csrf: bili_jct,
}
await post(historyReport, dataPost, getHeaders(), 'form');
}
let cd = getFullTime(detailData.duration);
const aid = detailData.aid;
const video = {
vod_id: bvid,
vod_name: detailData.title,
vod_pic: detailData.pic,
type_name: detailData.tname,
vod_year: '',
vod_area: '',
vod_remarks: cd,
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 accept_quality = playurldatalist.accept_quality;
const accept_description = playurldatalist.accept_description;
const qualitylist = [];
const descriptionList = [];
for (let i = 0; i < accept_quality.length; i++) {
if (!vip) {
if (!login) {
if (accept_quality[i] > 32) continue;
} else {
if (accept_quality[i] > 80) continue;
}
}
descriptionList.push(base64Encode(accept_description[i]));
qualitylist.push(accept_quality[i]);
}
let treeMap = {};
const jSONArray = detailData.pages;
let playList = [];
for (let j = 0; j < jSONArray.length; j++) {
const jSONObject6 = jSONArray[j];
const cid = jSONObject6.cid;
const playUrl = j + '$' + aid + '+' + cid + '+' + qualitylist.join(':') + '+' + descriptionList.join(':');
playList.push(playUrl);
}
treeMap['dash'] = playList.join('#');
treeMap['mp4'] = playList.join('#');
const relatedUrl = 'https://api.bilibili.com/x/web-interface/archive/related?bvid=' + bvid;
const relatedData = JSON.parse(await request(relatedUrl, getHeaders())).data;
playList = [];
for (let j = 0; j < relatedData.length; j++) {
const jSONObject6 = relatedData[j];
const cid = jSONObject6.cid;
const title = jSONObject6.title;
const aaid = jSONObject6.aid;
const playUrl = title + '$' + aaid + '+' + cid + '+' + qualitylist.join(':') + '+' + descriptionList.join(':');
playList.push(playUrl);
}
treeMap['相关'] = playList.join('#');
video.vod_play_from = Object.keys(treeMap).join("$$$");
video.vod_play_url = Object.values(treeMap).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(':');
const dan = 'https://api.bilibili.com/x/v1/dm/list.so?oid=' + cid;
if (flag == 'dash' || flag == '相关') {
// dash mpd 代理
const js2Base = await js2Proxy(true, siteType, siteKey, 'dash/', {});
let urls = [];
for (let i = 0; i < qualityIds.length; i++) {
urls.push(base64Decode(qualityName[i]), js2Base + base64Encode(aid + '+' + cid + '+' + qualityIds[i]));
}
return JSON.stringify({
parse: 0,
url: urls,
danmaku: dan,
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(base64Decode(qualityName[i]), durl);
}
return JSON.stringify({
parse: 0,
url: urls,
danmaku: dan,
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(base64Decode(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: '0',
};
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.33,
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;