update CAT

This commit is contained in:
qist
2024-04-28 14:09:31 +08:00
parent c87c455ba9
commit f41fe949cc
6 changed files with 50 additions and 37 deletions

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
9acc3aa6d144d74f7e7149763dd9a22f
0781ce50eb420e06572003b938aac220

6
cat/dist/index.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
6d76c79173d3e4328fc87a0d9d0001d3
3fafbf5c659be0299f3d22455362a9db

View File

@@ -1,4 +1,4 @@
import {__jsEvalReturn} from './liujiushu.js';
import {__jsEvalReturn} from './tiantian.js';
import * as Utils from "../lib/utils.js";
@@ -50,20 +50,33 @@ async function testMusicPlay(vodDetail) {
}
async function test() {
let siteKey = 'liujiushu';
let siteKey = 'tiantian';
let siteType = 0;
await spider.init({
skey: siteKey, stype: siteType, ext: {
"token": "6827db23e5474d02a07fd7431d3d5a5a",
"box": "TV",
"code": "1",
"from": "liujiushu",
"from": "tiantian",
"danmu": true,
"cookie": "buvid3=02675249-8ED3-C418-87F5-59E18316459714816infoc; b_nut=1704421014; _uuid=5D435F74-F574-D9AB-62C1-B9294DE465D913102infoc; buvid_fp=e8c5650c749398e9b5cad3f3ddb5081e; buvid4=007E85D1-52C1-7E6E-07CF-837FFBC9349516677-024010502-J5vTDSZDCw4fNnXRejbSVg%3D%3D; rpdid=|()kYJmulRu0J'u~|RRJl)JR; PVID=1; SESSDATA=3be091d3%2C1720332009%2C699ed%2A11CjAcCdwXG5kY1umhCOpQHOn_WP7L9xFBfWO7KKd4BPweodpR6VyIfeNyPiRmkr5jCqsSVjg0R0dZOVVHRUo3RnhPRTZFc3JPbGdiUjFCdHpiRDhiTkticmdKTjVyS1VhbDdvNjFMSDJlbUJydUlRdjFUNGFBNkJlV2ZTa0N1Q1BEVi1QYTQzTUh3IIEC; bili_jct=b0ee7b5d3f27df893545d811d95506d4; DedeUserID=78014638; DedeUserID__ckMd5=4c8c5d65065e468a; enable_web_push=DISABLE; header_theme_version=CLOSE; home_feed_column=5; CURRENT_BLACKGAP=0; CURRENT_FNVAL=4048; b_lsid=75E916AA_18EA1A8D995; bsource=search_baidu; FEED_LIVE_VERSION=V_HEADER_LIVE_NO_POP; browser_resolution=1507-691; bili_ticket=eyJhbGciOiJIUzI1NiIsImtpZCI6InMwMyIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MTIzNjk5MTMsImlhdCI6MTcxMjExMDY1MywicGx0IjotMX0.8zQW_fNTCSBlK_JkHnzu3gDw62wuTK1qgKcbGec3swM; bili_ticket_expires=171236985"
}
});
// 测试搜索
let classes = JSON.parse(await spider.home(true));
console.debug(JSON.stringify(classes))
//测试首页列表
let homeVod = JSON.parse(await spider.homeVod())
console.debug(JSON.stringify(homeVod));
//测试分类
let catePage = JSON.parse(await spider.category("1", "2", undefined, {"extend":"动作"}));
console.debug(JSON.stringify(catePage));
// 测试搜索
let search_page = JSON.parse(await spider.search("万相之王",false,1))
console.debug(JSON.stringify(search_page))
@@ -72,16 +85,7 @@ async function test() {
let play = JSON.parse(await spider.play("全卷","闻萱-/diyi/2449/43822990.html"))
await testPlay(detail1)
let classes = JSON.parse(await spider.home(true));
console.debug(JSON.stringify(classes))
//测试首页列表
let homeVod = JSON.parse(await spider.homeVod())
console.debug(JSON.stringify(homeVod));
//测试分类
let catePage = JSON.parse(await spider.category("/sort/2", "2", undefined, {}));
console.debug(JSON.stringify(catePage));

View File

@@ -81,21 +81,18 @@ class TianTianSpider extends Spider {
const param = {
type_id: tid, page: pg, limit: limit,
};
if (extend.class) {
param.class = extend.class;
if (extend["extend"] !== undefined && extend["extend"] !== "全部") {
param.class = extend["extend"];
}
if (extend.area) {
if (extend["area"] !== undefined && extend["area"] !== "全部") {
param.area = extend.area;
}
if (extend.lang) {
if (extend["lang"] !== undefined && extend["lang"] !== "全部") {
param.lang = extend.lang;
}
if (extend.year) {
if (extend["year"] !== undefined && extend["year"] !== "全部") {
param.year = extend.year;
}
// if (extend.order) {
// param.order = extend.order;
// }
return param;
}
@@ -104,10 +101,22 @@ class TianTianSpider extends Spider {
Object.keys(data).forEach(key => {
if (Array.isArray(data[key])) {
let extend_dic = {"key": key, "name": this.extendObj[key], "value": []}
let add_year_status = false
for (const extend_data of data[key]) {
extend_dic["value"].push({"n": extend_data, "v": extend_data})
if (key === "year") {
if (!data[key].includes("2024") && extend_data !== "全部" && !add_year_status) {
extend_dic["value"].push({"n": "2024", "v": "2024"})
add_year_status = true
}
}
if (!_.isEmpty(extend_data)) {
extend_dic["value"].push({"n": extend_data, "v": extend_data})
}
}
if (extend_dic["value"].length > 1) {
extend_list.push(extend_dic)
}
extend_list.push(extend_dic)
}
})
return extend_list
@@ -128,10 +137,10 @@ class TianTianSpider extends Spider {
for (const vodData of vodList) {
let vodShort = new VodShort()
vodShort.load_data(vodData)
if (_.isEmpty(vodShort.vod_pic) && vodData["vod_pic_thumb"] !== undefined){
if (_.isEmpty(vodShort.vod_pic) && vodData["vod_pic_thumb"] !== undefined) {
vodShort.vod_pic = vodData["vod_pic_thumb"]
}
if (vodShort.vod_name !== "首页轮播"){
if (vodShort.vod_name !== "首页轮播") {
vod_list.push(vodShort)
}
@@ -172,15 +181,15 @@ class TianTianSpider extends Spider {
for (const data of resJson["data"]["type_vod"]) {
if (data["type_name"] !== "广告") {
vod_list = await this.parseVodShortListFromJson(data["vod"])
this.homeVodList = [...this.homeVodList,...vod_list]
vod_list = await this.parseVodShortListFromJson(data["vod"])
this.homeVodList = [...this.homeVodList, ...vod_list]
}
}
vod_list = await this.parseVodShortListFromJson(resJson["data"]["loop"])
this.homeVodList = [...this.homeVodList,...vod_list]
this.homeVodList = [...this.homeVodList, ...vod_list]
vod_list = await this.parseVodShortListFromJson(resJson["data"]["cai"])
this.homeVodList = [...this.homeVodList,...vod_list]
this.homeVodList = [...this.homeVodList, ...vod_list]
}
async setCategory(tid, pg, filter, extend) {