|
|
|
@ -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 = []
|
|
|
|
@ -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 = []
|
|
|
|
|
|
|
|
if (this.liveJson[channelName] !== undefined) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
for (const data of obj["program"]) {
|
|
|
|
for (const data of obj["program"]) {
|
|
|
|
let episodeName = data["showTime"] + "-" + data["t"]
|
|
|
|
let episodeName = data["showTime"] + "-" + data["t"]
|
|
|
|
let episodeUrl = liveJson["hls_url"]["hls1"] + `?begintimeabs=${data["st"] * 1000}&endtimeabs=${data["et"] * 1000}`
|
|
|
|
let episodeUrl = liveUrl + `?begintimeabs=${data["st"] * 1000}&endtimeabs=${data["et"] * 1000}`
|
|
|
|
vod_items.push(episodeName + "$" + episodeUrl)
|
|
|
|
vod_items.push(episodeName + "$" + episodeUrl)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (vod_items.length > 0){
|
|
|
|
playList["点播"] = vod_items.join("#")
|
|
|
|
playList["点播"] = vod_items.join("#")
|
|
|
|
|
|
|
|
}
|
|
|
|
return playList
|
|
|
|
return playList
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|