Browse Source

1

Signed-off-by: dongchenys <14018478+dongchenys@user.noreply.gitee.com>
master
dongchenys 10 months ago
committed by Gitee
parent
commit
7277e74649
No known key found for this signature in database GPG Key ID: 173E9B9CA92EEF8F
  1. 1
      libs/Bot.js
  2. 39
      libs/aiqiyi.js
  3. 1
      libs/cheerio.min.js
  4. 6191
      libs/crypto-js.js
  5. 241
      libs/czzy_open.js
  6. 794
      libs/douban.json
  7. 37
      libs/drpy.js
  8. 1
      libs/drpy2.min.js
  9. 24
      libs/duanjv.js
  10. 68
      libs/gbk.js
  11. 90
      libs/jp.js
  12. 412
      libs/kkys_open.js

1
libs/Bot.js
File diff suppressed because one or more lines are too long
View File

39
libs/aiqiyi.js
File diff suppressed because one or more lines are too long
View File

1
libs/cheerio.min.js
File diff suppressed because one or more lines are too long
View File

6191
libs/crypto-js.js
File diff suppressed because it is too large
View File

241
libs/czzy_open.js

@ -0,0 +1,241 @@
import { Crypto, load, _ } from './lib/cat.js';
let key = 'czzy';
let url = 'https://cz01.cc';
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;
}
async function home(filter) {
let filterObj = {};
const html = await request(url + '/movie_bt');
const $ = load(html);
const series = $('div#beautiful-taxonomy-filters-tax-movie_bt_series > a[cat-url*=movie_bt_series]');
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;
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_name: $('div.moviedteail_tt > h1').text().trim(),
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,
};
}

794
libs/douban.json

@ -0,0 +1,794 @@
{
"hot_gaia": [
{
"key": "sort",
"name": "排序",
"value": [
{
"n": "热度",
"v": "recommend"
},
{
"n": "最新",
"v": "time"
},
{
"n": "评分",
"v": "rank"
}
]
},
{
"key": "area",
"name": "地区",
"value": [
{
"n": "全部",
"v": "全部"
},
{
"n": "华语",
"v": "华语"
},
{
"n": "欧美",
"v": "欧美"
},
{
"n": "韩国",
"v": "韩国"
},
{
"n": "日本",
"v": "日本"
}
]
}
],
"tv_hot": [
{
"key": "type",
"name": "分类",
"value": [
{
"n": "综合",
"v": "tv_hot"
},
{
"n": "国产剧",
"v": "tv_domestic"
},
{
"n": "欧美剧",
"v": "tv_american"
},
{
"n": "日剧",
"v": "tv_japanese"
},
{
"n": "韩剧",
"v": "tv_korean"
},
{
"n": "动画",
"v": "tv_animation"
}
]
}
],
"show_hot": [
{
"key": "type",
"name": "分类",
"value": [
{
"n": "综合",
"v": "show_hot"
},
{
"n": "国内",
"v": "show_domestic"
},
{
"n": "国外",
"v": "show_foreign"
}
]
}
],
"movie": [
{
"key": "类型",
"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": "短片",
"v": "短片"
}
]
},
{
"key": "地区",
"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": "丹麦",
"v": "丹麦"
}
]
},
{
"key": "sort",
"name": "排序",
"value": [
{
"n": "近期热度",
"v": "T"
},
{
"n": "首映时间",
"v": "R"
},
{
"n": "高分优先",
"v": "S"
}
]
},
{
"key": "年代",
"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": "2010年代",
"v": "2010年代"
},
{
"n": "2000年代",
"v": "2000年代"
},
{
"n": "90年代",
"v": "90年代"
},
{
"n": "80年代",
"v": "80年代"
},
{
"n": "70年代",
"v": "70年代"
},
{
"n": "60年代",
"v": "60年代"
},
{
"n": "更早",
"v": "更早"
}
]
}
],
"tv": [
{
"key": "类型",
"name": "类型",
"value": [
{
"n": "不限",
"v": ""
},
{
"n": "电视剧",
"v": "电视剧"
},
{
"n": "综艺",
"v": "综艺"
}
]
},
{
"key": "电视剧形式",
"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": "综艺形式",
"name": "综艺形式",
"value": [
{
"n": "不限",
"v": ""
},
{
"n": "真人秀",
"v": "真人秀"
},
{
"n": "脱口秀",
"v": "脱口秀"
},
{
"n": "音乐",
"v": "音乐"
},
{
"n": "歌舞",
"v": "歌舞"
}
]
},
{
"key": "地区",
"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": "爱尔兰",
"v": "爱尔兰"
},
{
"n": "澳大利亚",
"v": "澳大利亚"
}
]
},
{
"key": "sort",
"name": "排序",
"value": [
{
"n": "近期热度",
"v": "T"
},
{
"n": "首播时间",
"v": "R"
},
{
"n": "高分优先",
"v": "S"
}
]
},
{
"key": "年代",
"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": "2010年代",
"v": "2010年代"
},
{
"n": "2000年代",
"v": "2000年代"
},
{
"n": "90年代",
"v": "90年代"
},
{
"n": "80年代",
"v": "80年代"
},
{
"n": "70年代",
"v": "70年代"
},
{
"n": "60年代",
"v": "60年代"
},
{
"n": "更早",
"v": "更早"
}
]
},
{
"key": "平台",
"name": "平台",
"value": [
{
"n": "全部",
"v": ""
},
{
"n": "腾讯视频",
"v": "腾讯视频"
},
{
"n": "爱奇艺",
"v": "爱奇艺"
},
{
"n": "优酷",
"v": "优酷"
},
{
"n": "湖南卫视",
"v": "湖南卫视"
},
{
"n": "Netflix",
"v": "Netflix"
},
{
"n": "HBO",
"v": "HBO"
},
{
"n": "BBC",
"v": "BBC"
},
{
"n": "NHK",
"v": "NHK"
},
{
"n": "CBS",
"v": "CBS"
},
{
"n": "NBC",
"v": "NBC"
},
{
"n": "tvN",
"v": "tvN"
}
]
}
],
"rank_list_movie": [
{
"key": "榜单",
"name": "榜单",
"value": [
{
"n": "实时热门电影",
"v": "movie_real_time_hotest"
},
{
"n": "一周口碑电影榜",
"v": "movie_weekly_best"
},
{
"n": "豆瓣电影Top250",
"v": "movie_top250"
}
]
}
],
"rank_list_tv": [
{
"key": "榜单",
"name": "榜单",
"value": [
{
"n": "实时热门电视",
"v": "tv_real_time_hotest"
},
{
"n": "华语口碑剧集榜",
"v": "tv_chinese_best_weekly"
},
{
"n": "全球口碑剧集榜",
"v": "tv_global_best_weekly"
},
{
"n": "国内口碑综艺榜",
"v": "show_chinese_best_weekly"
},
{
"n": "国外口碑综艺榜",
"v": "show_global_best_weekly"
}
]
}
]
}

37
libs/drpy.js
File diff suppressed because one or more lines are too long
View File

1
libs/drpy2.min.js
File diff suppressed because one or more lines are too long
View File

24
libs/duanjv.js

@ -0,0 +1,24 @@
// 搜寻验证
var rule = {
title:'短视频',
host:'http://www.sharenice.net',
url:'/fyclass?page=fypage',
//searchUrl:'/video/search?search_key=**',
searchable:0,
quickSearch:0,
headers:{
'User-Agent':'PC_UA'
},
timeout:5000,
// class_name:'抖音&快手&微视&火山&场库&体育&美拍&秒拍&全民&梨&好兔&美女&正能量&搞笑&社会&游戏&娱乐&旅游&萌系&生活&音乐&美食&明星&动漫&影视&时尚',
class_name:'抖音&快手&微视&火山&场库&美拍&秒拍&全民&澎湃&好兔&开眼&美女&搞笑&社会&影视&音乐&娱乐&正能量&生活&动漫&体育&美食&萌系&旅游&游戏&明星&时尚',
// class_url:'douyin&kuaishou&weishi&huoshan&changku&tags/t-5L2T6IKy.html&meipai&miaopai&quanmin&lishipin&haotu&tags/t-576O5aWz.html&tags/t-5q2j6IO96YeP.html&tags/t-5pCe56yR.html&tags/t-56S+5Lya.html&tags/t-5ri45oiP.html&tags/t-5aix5LmQ.html&tags/t-5peF5ri4.html&tags/t-6JCM57O7.html&tags/t-55Sf5rS7.html&tags/t-6Z+z5LmQ.html&tags/t-576O6aOf.html&tags/t-5piO5pif.html&tags/t-5Yqo5ryr.html&tags/t-5b2x6KeG.html&tags/t-5pe25bCa.html',
class_url:'douyin&kuaishou&weishi&huoshan&changku&meipai&miaopai&quanmin&lishipin&haotu&kaiyan&t-576O5aWz&t-5pCe56yR&t-56S+5Lya&t-5b2x6KeG&t-6Z+z5LmQ&t-5aix5LmQ&t-5q2j6IO96YeP&t-55Sf5rS7&t-5Yqo5ryr&t-5L2T6IKy&t-576O6aOf&t-6JCM57O7&t-5peF5ri4&t-5ri45oiP&t-5piO5pif&t-5pe25bCa',
play_parse:true,
lazy:'js:/kuaishou/.test(input)?input=jsp.pdfh(request("http://m.sharenice.net/mobile"+input.split("net")[1]),".video-play-box&&video&&src"):input=jsp.pdfh(request("http://m.sharenice.net/mobile"+input.split("net")[1]),".video-play-box&&video&&src")+"#.mp4"',
limit:6,
double:false,
推荐:'*',
一级:'.item-box&&ul&&li;a&&title;img&&data-original;;a&&href',
二级:'*',
}

68
libs/gbk.js
File diff suppressed because one or more lines are too long
View File

90
libs/jp.js

@ -0,0 +1,90 @@
var rule = {
title:'荐片',
host:'http://api2.rinhome.com',
// homeUrl:'https://yjpapipxblwdohpakljwg.hxhzs.com/api/tag/hand?code=unknown601193cf375db73d&channel=wandoujia',//网站的首页链接,用于分类获取和推荐获取
homeUrl:'/api/tag/hand?code=unknown601193cf375db73d&channel=wandoujia',//网站的首页链接,用于分类获取和推荐获取
// url:'/api/crumb/list?area=0&category_id=fyclass&page=fypage&type=0&limit=24&fyfilter',
url:'/api/crumb/list?area=0&page=fypage&type=0&limit=24&fyfilter',
class_name:'全部&电影&电视剧&动漫&综艺', // 筛选 /api/term/ad_fenlei?limit=10&page=1
class_url:'0&1&2&3&4',
detailUrl:'/api/node/detail?channel=wandoujia&token=&id=fyid',//二级详情拼接链接(json格式用)
searchUrl:'/api/video/search?key=**&page=fypage',
searchable:2,
quickSearch:0,
filterable:1,
filter:{
"0":[{"key":"year","name":"年代","value":[{"n":"全部","v":"0"},{"n":"2023","v":"153"},{"n":"2022","v":"101"},{"n":"2021","v":"118"},{"n":"2020","v":"16"},{"n":"2019","v":"7"},{"n":"2018","v":"2"},{"n":"2017","v":"3"},{"n":"2016","v":"22"}]},{"key":"sort","name":"排序","value":[{"n":"热门","v":"hot"},{"n":"评分","v":"rating"},{"n":"更新","v":"update"}]}],
"1":[{"key":"cateId","name":"分类","value":[{"n":"全部","v":"1"},{"n":"首推","v":"5"},{"n":"动作","v":"6"},{"n":"喜剧","v":"7"},{"n":"战争","v":"8"},{"n":"恐怖","v":"9"},{"n":"剧情","v":"10"},{"n":"爱情","v":"11"},{"n":"科幻","v":"12"},{"n":"动画","v":"13"}]},{"key":"year","name":"年代","value":[{"n":"全部","v":"0"},{"n":"2023","v":"153"},{"n":"2022","v":"101"},{"n":"2021","v":"118"},{"n":"2020","v":"16"},{"n":"2019","v":"7"},{"n":"2018","v":"2"},{"n":"2017","v":"3"},{"n":"2016","v":"22"}]},{"key":"sort","name":"排序","value":[{"n":"热门","v":"hot"},{"n":"评分","v":"rating"},{"n":"更新","v":"update"}]}],
"2":[{"key":"cateId","name":"分类","value":[{"n":"全部","v":"2"},{"n":"首推","v":"14"},{"n":"国产","v":"15"},{"n":"港台","v":"16"},{"n":"日韩","v":"17"},{"n":"海外","v":"18"}]},{"key":"year","name":"年代","value":[{"n":"全部","v":"0"},{"n":"2023","v":"153"},{"n":"2022","v":"101"},{"n":"2021","v":"118"},{"n":"2020","v":"16"},{"n":"2019","v":"7"},{"n":"2018","v":"2"},{"n":"2017","v":"3"},{"n":"2016","v":"22"}]},{"key":"sort","name":"排序","value":[{"n":"热门","v":"hot"},{"n":"评分","v":"rating"},{"n":"更新","v":"update"}]}],
"3":[{"key":"cateId","name":"分类","value":[{"n":"全部","v":"3"},{"n":"首推","v":"19"},{"n":"海外","v":"20"},{"n":"日本","v":"21"},{"n":"国产","v":"22"}]},{"key":"year","name":"年代","value":[{"n":"全部","v":"0"},{"n":"2023","v":"153"},{"n":"2022","v":"101"},{"n":"2021","v":"118"},{"n":"2020","v":"16"},{"n":"2019","v":"7"},{"n":"2018","v":"2"},{"n":"2017","v":"3"},{"n":"2016","v":"22"}]},{"key":"sort","name":"排序","value":[{"n":"热门","v":"hot"},{"n":"评分","v":"rating"},{"n":"更新","v":"update"}]}],
"4":[{"key":"cateId","name":"分类","value":[{"n":"全部","v":"4"},{"n":"首推","v":"23"},{"n":"国产","v":"24"},{"n":"海外","v":"25"},{"n":"港台","v":"26"}]},{"key":"year","name":"年代","value":[{"n":"全部","v":"0"},{"n":"2023","v":"153"},{"n":"2022","v":"101"},{"n":"2021","v":"118"},{"n":"2020","v":"16"},{"n":"2019","v":"7"},{"n":"2018","v":"2"},{"n":"2017","v":"3"},{"n":"2016","v":"22"}]},{"key":"sort","name":"排序","value":[{"n":"热门","v":"hot"},{"n":"评分","v":"rating"},{"n":"更新","v":"update"}]}]
},
// filter_url:'sort={{fl.sort or "hot"}}&year={{fl.year or "0"}}',
filter_url:'sort={{fl.sort or "update"}}&year={{fl.year or "0"}}&category_id={{fl.cateId}}',
filter_def:{
0:{cateId:'0'},
1:{cateId:'1'},
2:{cateId:'2'},
3:{cateId:'3'},
4:{cateId:'4'}
},
headers:{
'User-Agent':'jianpian-android/350',
'JPAUTH':'y261ow7kF2dtzlxh1GS9EB8nbTxNmaK/QQIAjctlKiEv'
},
timeout:5000,
limit:8,
play_parse:true,
play_json:[{
re:'*',
json:{
parse:0,
jx:0
}
}],
lazy:'',
// double:true,
图片来源:'@Referer=www.jianpianapp.com@User-Agent=jianpian-version353',
// 推荐:'json:data;room;*;cover;*;*',
推荐:'json:.video;*;*;*;*',
一级:'json:data;title;path;playlist.title;id',
二级:{
// title:'data.title',
title:'data.title;data.types[0].name',
// desc:';data.description;data.id',
desc:'data.score;data.year.title;data.area.title;data.actors[0].name;data.directors[0].name',
img:'data.thumbnail',
// content:'data.thumbnail',
content:'data.description',
is_json:1,
tabs:`js:
TABS = [];
if (html.data.have_ftp_ur == 1) {
TABS.push("边下边播超清版")
}
if (html.data.have_m3u8_ur == 1) {
TABS.push("在线点播普清版")
}
`,
lists:`js:
log(TABS);
LISTS = [];
TABS.forEach(function(tab) {
if (/边下边播/.test(tab)) {
let ftp = html.data.new_ftp_list;
let d = ftp.map(function(it) {
return it.title + "$" + (/m3u8/.test(it.url) ? play_url + it.url : "tvbox-xg:" + it.url)
});
LISTS.push(d)
} else if (/在线点播/.test(tab)) {
let m3u = html.data.new_m3u8_list;
let d = m3u.map(function(it) {
return it.title + "$" + (/m3u8/.test(it.url) ? play_url + it.url : "tvbox-xg:" + it.url)
});
LISTS.push(d)
}
});
`,
},
搜索:'json:data;*;thumbnail;mask;*',
}

412
libs/kkys_open.js

@ -0,0 +1,412 @@
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;
// demo of block hls ads
if (/vip\.lz|hd\.lz/.test(result.url)) {
result.url = await js2Proxy(true, siteType, siteKey, 'lzm3u8/' + base64Encode(result.url), {});
}
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 proxy(segments, headers) {
let what = segments[0];
let url = base64Decode(segments[1]);
if (what == 'lzm3u8') {
const resp = await req(url, {});
let hls = resp.content;
const jsBase = await js2Proxy(false, siteType, siteKey, 'lzm3u8/', {});
const baseUrl = url.substr(0, url.lastIndexOf('/') + 1);
console.log(hls.length);
hls = hls.replace(/#EXT-X-DISCONTINUITY\r*\n*#EXTINF:6.433333,[\s\S]*?#EXT-X-DISCONTINUITY/, '');
console.log(hls.length);
hls = hls.replace(/(#EXT-X-KEY\S+URI=")(\S+)("\S+)/g, function (match, p1, p2, p3) {
let up = (!p2.startsWith('http') ? baseUrl : '') + p2;
return p1 + up + p3;
});
hls = hls.replace(/(#EXT-X-STREAM-INF:.*\n)(.*)/g, function (match, p1, p2) {
let up = (!p2.startsWith('http') ? baseUrl : '') + p2;
return p1 + jsBase + base64Encode(up);
});
hls = hls.replace(/(#EXTINF:.*\n)(.*)/g, function (match, p1, p2) {
let up = (!p2.startsWith('http') ? baseUrl : '') + p2;
return p1 + up;
});
return JSON.stringify({
code: resp.code,
content: hls,
headers: resp.headers,
});
}
return JSON.stringify({
code: 500,
content: '',
});
}
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,
});
}
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));
}
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,
proxy: proxy,
search: search,
};
}
Loading…
Cancel
Save