update CAT

This commit is contained in:
qist 2024-05-09 10:42:34 +08:00
parent 6605d4f19e
commit a585001061
7 changed files with 55 additions and 49 deletions

4
cat/dist/index.js vendored

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
880995fd4c5d4db2a34315a562333cf8 4c0357154fb6018c7a01bd8623f71eb3

View File

@ -485,7 +485,7 @@
{ {
"name": "live", "name": "live",
"type": 0, "type": 0,
"url": "https://agit.ai/fantaiying/0/raw/branch/main/tvlive.txt", "url": "https://gh.con.sh/https://github.com/jadehh/LiveSpider/blob/main/live/live.txt",
"playerType": 1, "playerType": 1,
"ua": "okhttp/3.15", "ua": "okhttp/3.15",
"epg": "http://epg.112114.xyz/?ch={name}&date={date}", "epg": "http://epg.112114.xyz/?ch={name}&date={date}",

View File

@ -10,11 +10,13 @@ import {Spider} from "./spider.js";
import {_} from "../lib/cat.js"; import {_} from "../lib/cat.js";
import * as Utils from "../lib/utils.js"; import * as Utils from "../lib/utils.js";
import {VodDetail, VodShort} from "../lib/vod.js"; import {VodDetail, VodShort} from "../lib/vod.js";
class CNTVSpider extends Spider { class CNTVSpider extends Spider {
constructor() { constructor() {
super(); super();
this.siteUrl = "https://tv.cctv.com/m/index.shtml" this.siteUrl = "https://tv.cctv.com/m/index.shtml"
this.apiUrl = "https://api.app.cctv.com" this.apiUrl = "https://api.app.cctv.com"
this.liveJsonUrl = "https://gh.con.sh/https://github.com/jadehh/LiveSpider/blob/main/json/live.json"
} }
@ -34,6 +36,15 @@ class CNTVSpider extends Spider {
return 3 return 3
} }
async spiderInit() {
await super.spiderInit();
this.liveJson = JSON.parse(await this.fetch(this.liveJsonUrl, null, null))
}
async init(cfg) {
await super.init(cfg);
await this.spiderInit()
}
async getFilterByLive(dataList) { async getFilterByLive(dataList) {
let extend_list = [] let extend_list = []
@ -47,10 +58,10 @@ class CNTVSpider extends Spider {
return extend_list return extend_list
} }
arrayIsinclude(str,items){ arrayIsinclude(str, items) {
let isInclude = false let isInclude = false
for (const data of items){ for (const data of items) {
if (str === data["title"]){ if (str === data["title"]) {
return true return true
} }
} }
@ -64,12 +75,12 @@ class CNTVSpider extends Spider {
let extend_dic = {"key": data["classname"], "name": data["title"], "value": []} let extend_dic = {"key": data["classname"], "name": data["title"], "value": []}
for (const extendData of data["items"]) { for (const extendData of data["items"]) {
if (data["classname"] === "nianfen") { if (data["classname"] === "nianfen") {
if (!this.arrayIsinclude("2024",data["items"]) && extendData["title"] !== "全部" && !add_year_status) { if (!this.arrayIsinclude("2024", data["items"]) && extendData["title"] !== "全部" && !add_year_status) {
extend_dic["value"].push({"n": "2024", "v": "2024"}) extend_dic["value"].push({"n": "2024", "v": "2024"})
add_year_status = true add_year_status = true
} }
} }
extend_dic["value"].push({"n": extendData["title"], "v":extendData["title"]}) extend_dic["value"].push({"n": extendData["title"], "v": extendData["title"]})
} }
extend_list.push(extend_dic) extend_list.push(extend_dic)
} }
@ -150,15 +161,23 @@ class CNTVSpider extends Spider {
let liveResponse = await req(liveApiUrl, {"headers": this.getHeader()}) let liveResponse = await req(liveApiUrl, {"headers": this.getHeader()})
let liveJson = JSON.parse(liveResponse["content"]) let liveJson = JSON.parse(liveResponse["content"])
let playList = {} let playList = {}
playList["直播"] = ["点击播放$" + liveJson["hls_url"]["hls2"]] let channelName = obj["channelName"].split(" ")[0].replaceAll("-", "").toLowerCase()
let liveUrl = this.liveJson[channelName] ?? liveJson["hls_url"]["hls2"]
playList["直播"] = ["点击播放$" + liveUrl]
await this.jadeLog.info(`liveJson:${JSON.stringify(liveJson)}`) await this.jadeLog.info(`liveJson:${JSON.stringify(liveJson)}`)
let vod_items = [] let vod_items = []
for (const data of obj["program"]) { if (this.liveJson[channelName] !== undefined) {
let episodeName = data["showTime"] + "-" + data["t"]
let episodeUrl = liveJson["hls_url"]["hls1"] + `?begintimeabs=${data["st"] * 1000}&endtimeabs=${data["et"] * 1000}` } else {
vod_items.push(episodeName + "$" + episodeUrl) for (const data of obj["program"]) {
let episodeName = data["showTime"] + "-" + data["t"]
let episodeUrl = liveUrl + `?begintimeabs=${data["st"] * 1000}&endtimeabs=${data["et"] * 1000}`
vod_items.push(episodeName + "$" + episodeUrl)
}
}
if (vod_items.length > 0){
playList["点播"] = vod_items.join("#")
} }
playList["点播"] = vod_items.join("#")
return playList return playList
} }
@ -233,11 +252,11 @@ class CNTVSpider extends Spider {
this.homeVodList = await this.parseVodShortListFromJson(resJson["data"]["templates"]) this.homeVodList = await this.parseVodShortListFromJson(resJson["data"]["templates"])
} }
getExtendValue(extend,key){ getExtendValue(extend, key) {
if (extend[key] !== undefined && extend[key] !== "全部"){ if (extend[key] !== undefined && extend[key] !== "全部") {
return extend[key] return extend[key]
} }
return "" return ""
} }
async setCategory(tid, pg, filter, extend) { async setCategory(tid, pg, filter, extend) {
@ -247,10 +266,10 @@ class CNTVSpider extends Spider {
let response = JSON.parse(await this.fetch(url, null, this.getHeader())) let response = JSON.parse(await this.fetch(url, null, this.getHeader()))
this.vodList = this.parseVodShortByJson(response["data"]["templates"][0]["items"]) this.vodList = this.parseVodShortByJson(response["data"]["templates"][0]["items"])
} else { } else {
let letter = this.getExtendValue(extend,"zimu") let letter = this.getExtendValue(extend, "zimu")
let area = this.getExtendValue(extend,"diqu") let area = this.getExtendValue(extend, "diqu")
let type = this.getExtendValue(extend,"leixing") let type = this.getExtendValue(extend, "leixing")
let year = this.getExtendValue(extend,"nianfen") let year = this.getExtendValue(extend, "nianfen")
const limit = 12 const limit = 12
let url = "https://api.cntv.cn" + `/newVideoset/getCboxVideoAlbumList` let url = "https://api.cntv.cn" + `/newVideoset/getCboxVideoAlbumList`
let params = { let params = {

View File

@ -1,4 +1,4 @@
import {__jsEvalReturn} from './lovemovie18.js'; import {__jsEvalReturn} from './cntv.js';
import * as Utils from "../lib/utils.js"; import * as Utils from "../lib/utils.js";
@ -51,49 +51,36 @@ async function testMusicPlay(vodDetail) {
} }
async function test() { async function test() {
let siteKey = 'lovemovie18'; let siteKey = 'cntv';
let siteType = 3; let siteType = 3;
await spider.init({ await spider.init({
skey: siteKey, stype: siteType, ext: { skey: siteKey, stype: siteType, ext: {
"token": "6827db23e5474d02a07fd7431d3d5a5a", "token": "6827db23e5474d02a07fd7431d3d5a5a",
"box": "TV", "box": "TV",
"code": "1", "code": "1",
"from": "lovemovie18", "from": "cntv",
"danmu": true, "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" "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)); let classes = JSON.parse(await spider.home(true));
console.debug(JSON.stringify(classes)) console.debug(JSON.stringify(classes))
// 测试详情
let detail1 = JSON.parse(await spider.detail("/shechu/HODV21864binv1riSEXyoutiancaiyexiangqibing/"))
await testPlay(detail1)
// 测试搜索
let search_page = JSON.parse(await spider.search("完美世界",false,1))
console.debug(JSON.stringify(search_page))
// 测试分类
let catePage = JSON.parse(await spider.category("/tvb/", "2", undefined, {"class":"/guochan/"}));
console.debug(JSON.stringify(catePage));
//测试首页列表 //测试首页列表
let homeVod = JSON.parse(await spider.homeVod()) let homeVod = JSON.parse(await spider.homeVod())
console.debug(JSON.stringify(homeVod)); console.debug(JSON.stringify(homeVod));
// 测试分类
let catePage = JSON.parse(await spider.category("72", "2", undefined, {"live":"101"}));
console.debug(JSON.stringify(catePage))
// 测试详情
let detail1 = JSON.parse(await spider.detail("live-cctv2-https://app.cctv.com/special/appchannellogo/rectangle/l/cctv1.png?q=75"))
await testPlay(detail1)
// 测试搜索
let search_page = JSON.parse(await spider.search("完美世界", false, 1))
console.debug(JSON.stringify(search_page))

View File

@ -16,7 +16,7 @@ import {Spider} from "./spider.js";
class WoggSpider extends Spider { class WoggSpider extends Spider {
constructor() { constructor() {
super(); super();
this.siteUrl = 'https://tvfan.xxooo.cf'; this.siteUrl = 'https://www.wogg.xyz';
this.woggTypeObj = {"玩偶电影":"电影","玩偶剧集":"电视剧"} this.woggTypeObj = {"玩偶电影":"电影","玩偶剧集":"电视剧"}
} }

View File

@ -725,7 +725,7 @@
{ {
"name": "live", "name": "live",
"type": 0, "type": 0,
"url": "https://agit.ai/fantaiying/0/raw/branch/main/tvlive.txt", "url": "https://gh.con.sh/https://github.com/jadehh/LiveSpider/blob/main/live/live.txt",
"playerType": 1, "playerType": 1,
"ua": "okhttp/3.15", "ua": "okhttp/3.15",
"epg": "http://epg.112114.xyz/?ch={name}&date={date}", "epg": "http://epg.112114.xyz/?ch={name}&date={date}",