mirror of
https://github.com/qist/tvbox.git
synced 2025-10-26 17:52:20 +00:00
update CAT
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
|||||||
0781ce50eb420e06572003b938aac220
|
386350685603251deb582749f2a79360
|
||||||
444
cat/dist/index.js
vendored
444
cat/dist/index.js
vendored
File diff suppressed because one or more lines are too long
2
cat/dist/index.js.md5
vendored
2
cat/dist/index.js.md5
vendored
@@ -1 +1 @@
|
|||||||
7cdb41acf1d6e9f50c551a80c8c60ed5
|
880995fd4c5d4db2a34315a562333cf8
|
||||||
@@ -78,6 +78,17 @@
|
|||||||
"playerType": 0,
|
"playerType": 0,
|
||||||
"type": 3
|
"type": 3
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"key": "lovemovie18",
|
||||||
|
"name": "🔞┃爱情电影网18+┃🔞",
|
||||||
|
"api": "./js/lovemovie18.js",
|
||||||
|
"timeout": 30,
|
||||||
|
"ext": {
|
||||||
|
"box": "CatOpen"
|
||||||
|
},
|
||||||
|
"playerType": 0,
|
||||||
|
"type": 3
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"key": "asianx",
|
"key": "asianx",
|
||||||
"name": "🔞┃海外宅┃🔞",
|
"name": "🔞┃海外宅┃🔞",
|
||||||
|
|||||||
@@ -77,6 +77,17 @@
|
|||||||
"playerType": 0,
|
"playerType": 0,
|
||||||
"type": 3
|
"type": 3
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"key": "lovemovie18",
|
||||||
|
"name": "🔞┃爱情电影网18+┃🔞",
|
||||||
|
"api": "./js/lovemovie18.js",
|
||||||
|
"timeout": 30,
|
||||||
|
"ext": {
|
||||||
|
"box": "TVBox"
|
||||||
|
},
|
||||||
|
"playerType": 0,
|
||||||
|
"type": 3
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"key": "asianx",
|
"key": "asianx",
|
||||||
"name": "🔞┃海外宅┃🔞",
|
"name": "🔞┃海外宅┃🔞",
|
||||||
|
|||||||
@@ -10,9 +10,6 @@ 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";
|
||||||
import * as util from "util";
|
|
||||||
import {it} from "node:test";
|
|
||||||
|
|
||||||
class CNTVSpider extends Spider {
|
class CNTVSpider extends Spider {
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
|
|||||||
328
cat/tjs/js/lovemovie.js
Normal file
328
cat/tjs/js/lovemovie.js
Normal file
@@ -0,0 +1,328 @@
|
|||||||
|
/*
|
||||||
|
* @File : lovemovie.js
|
||||||
|
* @Author : jade
|
||||||
|
* @Date : 2024/4/29 09:36
|
||||||
|
* @Email : jadehh@1ive.com
|
||||||
|
* @Software : Samples
|
||||||
|
* @Desc : 爱情电影网
|
||||||
|
*/
|
||||||
|
import {Spider} from "./spider.js";
|
||||||
|
import {_, Crypto, load} from "../lib/cat.js";
|
||||||
|
import {VodDetail, VodShort} from "../lib/vod.js";
|
||||||
|
import * as Utils from "../lib/utils.js";
|
||||||
|
import {gbk_us} from "../lib/gbk_us.js";
|
||||||
|
|
||||||
|
class LoveMovieSpider extends Spider {
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
this.siteUrl = "https://b.aqdyje.com"
|
||||||
|
this.removeKey = "骑兵营"
|
||||||
|
}
|
||||||
|
|
||||||
|
getName() {
|
||||||
|
return "💕┃爱情电影网┃💕"
|
||||||
|
}
|
||||||
|
|
||||||
|
getAppName() {
|
||||||
|
return "爱情电影网"
|
||||||
|
}
|
||||||
|
|
||||||
|
getJSName() {
|
||||||
|
return "lovemovie"
|
||||||
|
}
|
||||||
|
|
||||||
|
getType() {
|
||||||
|
return 3
|
||||||
|
}
|
||||||
|
|
||||||
|
async init(cfg) {
|
||||||
|
await super.init(cfg);
|
||||||
|
}
|
||||||
|
|
||||||
|
async getHtml(url = this.siteUrl, proxy = false, headers = this.getHeader()) {
|
||||||
|
let buffer = await this.fetch(url, null, headers, false, false, 1, proxy)
|
||||||
|
|
||||||
|
let html = Utils.decode(buffer, "gb2312")
|
||||||
|
await this.jadeLog.debug(`html content:${html}`)
|
||||||
|
if (!_.isEmpty(html)) {
|
||||||
|
return load(html)
|
||||||
|
} else {
|
||||||
|
return load(gbkDecode(buffer))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async getFilter($, navElements) {
|
||||||
|
let extend_list = []
|
||||||
|
let extend_dic = {"key": "class", "name": "类型", "value": [this.getFliterDic("全部", "全部")]}
|
||||||
|
for (const navElement of $(navElements).find("li")) {
|
||||||
|
let element = $(navElement).find("a")[0]
|
||||||
|
let type_name = $(element).text()
|
||||||
|
let type_id = element.attribs.href
|
||||||
|
extend_dic["value"].push(this.getFliterDic(type_name, type_id))
|
||||||
|
}
|
||||||
|
if (extend_dic["value"].length > 1) {
|
||||||
|
extend_list.push(extend_dic)
|
||||||
|
}
|
||||||
|
return extend_list
|
||||||
|
}
|
||||||
|
|
||||||
|
async setClasses() {
|
||||||
|
let $ = await this.getHtml()
|
||||||
|
let navElements = $("[class=\"nav-item drop-down \"]")
|
||||||
|
for (const navElement of navElements) {
|
||||||
|
let elemenet = $(navElement).find("a")[0]
|
||||||
|
let type_name = $(elemenet).text()
|
||||||
|
let type_id = elemenet.attribs.href
|
||||||
|
if (type_name !== this.removeKey) {
|
||||||
|
this.classes.push(this.getTypeDic(type_name, type_id))
|
||||||
|
this.filterObj[type_id] = await this.getFilter($, navElement)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async parseVodShortListFromDoc($) {
|
||||||
|
let vod_list = []
|
||||||
|
let vodElements = $("[class=\"play-img\"]")
|
||||||
|
if (vodElements.length === 0) {
|
||||||
|
vodElements = $("[class=\"show-list list-mode fn-clear\"]").find("li")
|
||||||
|
}
|
||||||
|
for (const vodElement of vodElements) {
|
||||||
|
let vodShort = new VodShort()
|
||||||
|
vodShort.vod_id = vodElement.attribs.href
|
||||||
|
if (_.isEmpty(vodShort.vod_id)) {
|
||||||
|
vodShort.vod_id = $(vodElement).find("a")[0].attribs.href
|
||||||
|
}
|
||||||
|
let imgElement = $(vodElement).find("img")[0]
|
||||||
|
vodShort.vod_pic = imgElement.attribs.src
|
||||||
|
vodShort.vod_name = imgElement.attribs.alt
|
||||||
|
for (const element of $(vodElement).find("label")) {
|
||||||
|
let text = $(element).text().trim()
|
||||||
|
if (!_.isEmpty(text)) {
|
||||||
|
vodShort.vod_remarks = text
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (_.isEmpty(vodShort.vod_remarks)) {
|
||||||
|
vodShort.vod_remarks = $($(vodElement).find("p")[0]).text().replace("\n")
|
||||||
|
}
|
||||||
|
vod_list.push(vodShort)
|
||||||
|
}
|
||||||
|
return vod_list
|
||||||
|
}
|
||||||
|
|
||||||
|
async parseVodShortListFromDocBySearch($) {
|
||||||
|
let vodElements = $("[class=\"show-list\"]").find("li")
|
||||||
|
let vod_list = []
|
||||||
|
for (const vodElement of vodElements) {
|
||||||
|
let vodShort = new VodShort()
|
||||||
|
vodShort.vod_id = $(vodElement).find("a")[0].attribs.href
|
||||||
|
let imgElement = $(vodElement).find("img")[0]
|
||||||
|
vodShort.vod_pic = imgElement.attribs.src
|
||||||
|
vodShort.vod_name = imgElement.attribs.alt
|
||||||
|
vodShort.vod_remarks = $($(vodElement).find("[class=\"type fn-left\"]")).text().replace("类型:", "")
|
||||||
|
if (vodShort.vod_remarks !== "社处片" && vodShort.vod_remarks !== "社保片" && vodShort.vod_remarks !== "撸丝片" && vodShort.vod_remarks !== "撸丝动漫") {
|
||||||
|
vod_list.push(vodShort)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return vod_list
|
||||||
|
}
|
||||||
|
|
||||||
|
async parseVodDetailFromDoc($) {
|
||||||
|
let vodDetail = new VodDetail()
|
||||||
|
let imgElement = $("[class=\"detail-pic fn-left\"]").find("img")[0]
|
||||||
|
vodDetail.vod_pic = imgElement.attribs.src
|
||||||
|
vodDetail.vod_name = imgElement.attribs.alt
|
||||||
|
let vodInfoElement = $("[class=\"info fn-clear\"]")
|
||||||
|
for (const vodDlElement of $(vodInfoElement).find("dl")) {
|
||||||
|
let text = $(vodDlElement).text()
|
||||||
|
if (text.indexOf("主演") > -1) {
|
||||||
|
vodDetail.vod_actor = text.replaceAll("主演:", "").replaceAll("\n", "")
|
||||||
|
}
|
||||||
|
if (text.indexOf("状态") > -1) {
|
||||||
|
vodDetail.vod_remarks = text.replaceAll("状态:", "").replaceAll("\n", "")
|
||||||
|
}
|
||||||
|
if (text.indexOf("类型") > -1) {
|
||||||
|
vodDetail.type_name = text.replaceAll("类型:", "").replaceAll("\n", "")
|
||||||
|
}
|
||||||
|
if (text.indexOf("地区") > -1) {
|
||||||
|
vodDetail.vod_area = text.replaceAll("地区:", "").replaceAll("\n", "")
|
||||||
|
}
|
||||||
|
if (text.indexOf("导演") > -1) {
|
||||||
|
vodDetail.vod_director = text.replaceAll("导演:", "").replaceAll("\n", "")
|
||||||
|
}
|
||||||
|
if (text.indexOf("年份") > -1) {
|
||||||
|
vodDetail.vod_year = text.replaceAll("年份:", "").replaceAll("\n", "")
|
||||||
|
}
|
||||||
|
if (text.indexOf("剧情") > -1) {
|
||||||
|
vodDetail.vod_content = text.replaceAll("剧情:", "").replaceAll("\n", "")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let playList = {}
|
||||||
|
let html = $.html()
|
||||||
|
let playListElements = $("[class=\"play-list\"]")
|
||||||
|
let index = 1
|
||||||
|
for (const playListElement of playListElements) {
|
||||||
|
let playName = `播放连接-${index}`
|
||||||
|
let vodItems = []
|
||||||
|
for (const playUrlElement of $(playListElement).find("a")) {
|
||||||
|
let playUrlName = playUrlElement.attribs.title
|
||||||
|
let playUrl = playUrlElement.attribs.href
|
||||||
|
vodItems.push(playUrlName + "$" + playUrl)
|
||||||
|
}
|
||||||
|
playList[playName] = vodItems.join("#")
|
||||||
|
index = index + 1
|
||||||
|
}
|
||||||
|
index = 1
|
||||||
|
let ciliListElements = $("[class=\"con4\"]")
|
||||||
|
for (const ciliListElement of ciliListElements) {
|
||||||
|
let playName = `磁力链接-${index}`
|
||||||
|
let vodItems = []
|
||||||
|
let playUrlName = playName
|
||||||
|
let playUrl = $($(ciliListElement).find("div")).find("a")[0].attribs.href
|
||||||
|
if (playUrl !== "javascript:void(0);") {
|
||||||
|
vodItems.push(playUrlName + "$" + playUrl)
|
||||||
|
playList[playName] = vodItems.join("#")
|
||||||
|
index = index + 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
vodDetail.vod_play_url = _.values(playList).join('$$$');
|
||||||
|
vodDetail.vod_play_from = _.keys(playList).join('$$$');
|
||||||
|
return vodDetail
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
async setHomeVod() {
|
||||||
|
let $ = await this.getHtml()
|
||||||
|
this.homeVodList = await this.parseVodShortListFromDoc($)
|
||||||
|
}
|
||||||
|
|
||||||
|
async setDetail(id) {
|
||||||
|
let $ = await this.getHtml(this.siteUrl + id)
|
||||||
|
this.vodDetail = await this.parseVodDetailFromDoc($)
|
||||||
|
}
|
||||||
|
|
||||||
|
getExtend(extend) {
|
||||||
|
if (extend["class"] !== undefined) {
|
||||||
|
if (extend["class"] !== "全部") {
|
||||||
|
return extend["class"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
async setCategory(tid, pg, filter, extend) {
|
||||||
|
let classes = this.getExtend(extend) ?? tid
|
||||||
|
let url
|
||||||
|
if (classes === tid) {
|
||||||
|
url = this.siteUrl + classes
|
||||||
|
} else {
|
||||||
|
if (parseInt(pg) === 1) {
|
||||||
|
url = this.siteUrl + classes
|
||||||
|
} else {
|
||||||
|
url = this.siteUrl + classes + `index${pg}.html`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let $ = await this.getHtml(url)
|
||||||
|
this.vodList = await this.parseVodShortListFromDoc($)
|
||||||
|
}
|
||||||
|
|
||||||
|
async setPlay(flag, id, flags) {
|
||||||
|
if (flag.indexOf("磁力") > -1) {
|
||||||
|
this.playUrl = id
|
||||||
|
} else {
|
||||||
|
let idSplitList = id.split("-")
|
||||||
|
let flag_id = parseInt(idSplitList[1])
|
||||||
|
let episode = parseInt(idSplitList[2].split(".")[0])
|
||||||
|
let $ = await this.getHtml(this.siteUrl + id)
|
||||||
|
let playJsUrl = Utils.getStrByRegex(/<script type="text\/javascript" src="(.*?)">/, $.html())
|
||||||
|
let playJsContent = await this.fetch(this.siteUrl + playJsUrl, null, this.getHeader())
|
||||||
|
let playUrlListStr = Utils.getStrByRegex(/var VideoListJson=(.*?),urlinfo=/, playJsContent)
|
||||||
|
let playDic = eval(playUrlListStr)
|
||||||
|
this.playUrl = playDic[flag_id][1][episode].split("$")[1]
|
||||||
|
if (this.playUrl.indexOf("m3u8") === -1) {
|
||||||
|
let html = await this.fetch(this.playUrl, null, this.getHeader())
|
||||||
|
this.playUrl = Utils.getStrByRegex(/url: '(.*?)'/, html)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GBKEncode(str) {
|
||||||
|
var arr_index = 0x8140; //33088;
|
||||||
|
str += '';
|
||||||
|
var gbk = [];
|
||||||
|
var wh = '?'.charCodeAt(0); //gbk中没有的字符的替换符
|
||||||
|
for (var i = 0; i < str.length; i++) {
|
||||||
|
var charcode = str.charCodeAt(i);
|
||||||
|
if (charcode < 0x80) gbk.push(charcode);
|
||||||
|
else {
|
||||||
|
var gcode = gbk_us.indexOf(charcode);
|
||||||
|
if (~gcode) {
|
||||||
|
gcode += arr_index;
|
||||||
|
gbk.push(0xFF & (gcode >> 8), 0xFF & gcode);
|
||||||
|
} else {
|
||||||
|
gbk.push(wh);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return gbk;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
encode(str) {
|
||||||
|
let encodeStr = ""
|
||||||
|
for (const ch of str) {
|
||||||
|
let bitArr = this.GBKEncode(ch);
|
||||||
|
for (let i = 0; i < bitArr.length; i++) {
|
||||||
|
bitArr[i] = '%' + ('0' + bitArr[i].toString(16)).substr(-2).toUpperCase();
|
||||||
|
}
|
||||||
|
encodeStr = encodeStr + bitArr.join('');
|
||||||
|
}
|
||||||
|
return encodeStr
|
||||||
|
}
|
||||||
|
|
||||||
|
async setSearch(wd, quick) {
|
||||||
|
let params = {"searchword": this.encode(wd)}
|
||||||
|
let buffer = await this.post(this.siteUrl + "/search.asp", params, this.getHeader(), "form", 1)
|
||||||
|
let $ = load(Utils.decode(buffer, "gb2312"))
|
||||||
|
this.vodList = await this.parseVodShortListFromDocBySearch($)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
let spider = new LoveMovieSpider()
|
||||||
|
|
||||||
|
async function init(cfg) {
|
||||||
|
await spider.init(cfg)
|
||||||
|
}
|
||||||
|
|
||||||
|
async function home(filter) {
|
||||||
|
return await spider.home(filter)
|
||||||
|
}
|
||||||
|
|
||||||
|
async function homeVod() {
|
||||||
|
return await spider.homeVod()
|
||||||
|
}
|
||||||
|
|
||||||
|
async function category(tid, pg, filter, extend) {
|
||||||
|
return await spider.category(tid, pg, filter, extend)
|
||||||
|
}
|
||||||
|
|
||||||
|
async function detail(id) {
|
||||||
|
return await spider.detail(id)
|
||||||
|
}
|
||||||
|
|
||||||
|
async function play(flag, id, flags) {
|
||||||
|
return await spider.play(flag, id, flags)
|
||||||
|
}
|
||||||
|
|
||||||
|
async function search(wd, quick) {
|
||||||
|
return await spider.search(wd, quick)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function __jsEvalReturn() {
|
||||||
|
return {
|
||||||
|
init: init, home: home, homeVod: homeVod, category: category, detail: detail, play: play, search: search,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export {spider, LoveMovieSpider}
|
||||||
133
cat/tjs/js/lovemovie18.js
Normal file
133
cat/tjs/js/lovemovie18.js
Normal file
@@ -0,0 +1,133 @@
|
|||||||
|
/*
|
||||||
|
* @File : lovemovie18.js
|
||||||
|
* @Author : jade
|
||||||
|
* @Date : 2024/4/29 09:36
|
||||||
|
* @Email : jadehh@1ive.com
|
||||||
|
* @Software : Samples
|
||||||
|
* @Desc : 爱情电影网
|
||||||
|
*/
|
||||||
|
import {LoveMovieSpider} from "./lovemovie.js";
|
||||||
|
import {VodShort} from "../lib/vod.js";
|
||||||
|
|
||||||
|
class LoveMovie18Spider extends LoveMovieSpider {
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
this.siteUrl = "https://b.aqdyje.com"
|
||||||
|
this.removeKey = "骑兵营"
|
||||||
|
}
|
||||||
|
|
||||||
|
getName() {
|
||||||
|
return "🔞┃爱情电影网18+┃🔞"
|
||||||
|
}
|
||||||
|
|
||||||
|
getAppName() {
|
||||||
|
return "爱情电影网18+"
|
||||||
|
}
|
||||||
|
|
||||||
|
getJSName() {
|
||||||
|
return "lovemovie18"
|
||||||
|
}
|
||||||
|
|
||||||
|
getType() {
|
||||||
|
return 3
|
||||||
|
}
|
||||||
|
|
||||||
|
async parseVodShortListFromDocBySearch($) {
|
||||||
|
let vodElements = $("[class=\"show-list\"]").find("li")
|
||||||
|
let vod_list = []
|
||||||
|
for (const vodElement of vodElements) {
|
||||||
|
let vodShort = new VodShort()
|
||||||
|
vodShort.vod_id = $(vodElement).find("a")[0].attribs.href
|
||||||
|
let imgElement = $(vodElement).find("img")[0]
|
||||||
|
vodShort.vod_pic = imgElement.attribs.src
|
||||||
|
vodShort.vod_name = imgElement.attribs.alt
|
||||||
|
vodShort.vod_remarks = $($(vodElement).find("[class=\"type fn-left\"]")).text().replace("类型:", "")
|
||||||
|
if (vodShort.vod_remarks === "社处片" || vodShort.vod_remarks === "社保片" || vodShort.vod_remarks === "撸丝片" || vodShort.vod_remarks === "撸丝动漫") {
|
||||||
|
vod_list.push(vodShort)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return vod_list
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
async getFilter(type_id) {
|
||||||
|
let $ = await this.getHtml(this.siteUrl + type_id)
|
||||||
|
let extend_list = []
|
||||||
|
let extend_dic = {"key": "class", "name": "类型", "value": []}
|
||||||
|
for (const navElement of $("[class=\"subnav-tv fn-left\"]").find("a")) {
|
||||||
|
let type_name = $(navElement).text()
|
||||||
|
let type_id = navElement.attribs.href
|
||||||
|
extend_dic["value"].push(this.getFliterDic(type_name, type_id))
|
||||||
|
}
|
||||||
|
if (extend_dic["value"].length > 1) {
|
||||||
|
extend_list.push(extend_dic)
|
||||||
|
}
|
||||||
|
return extend_list
|
||||||
|
}
|
||||||
|
|
||||||
|
async setClasses() {
|
||||||
|
let $ = await this.getHtml()
|
||||||
|
let navElements = $("[class=\"nav-item drop-down \"]")
|
||||||
|
this.classes = []
|
||||||
|
for (const navElement of navElements) {
|
||||||
|
let element = $(navElement).find("a")[0]
|
||||||
|
let type_name = $(element).text()
|
||||||
|
let type_id = element.attribs.href
|
||||||
|
if (type_name === this.removeKey) {
|
||||||
|
this.classes.push(this.getTypeDic(type_name, type_id))
|
||||||
|
this.filterObj[type_id] = await this.getFilter(type_id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async setCategory(tid, pg, filter, extend) {
|
||||||
|
let classes = this.getExtend(extend) ?? tid
|
||||||
|
let url
|
||||||
|
if (parseInt(pg) === 1) {
|
||||||
|
url = this.siteUrl + classes
|
||||||
|
} else {
|
||||||
|
url = this.siteUrl + classes + `index${pg}.html`
|
||||||
|
}
|
||||||
|
let $ = await this.getHtml(url)
|
||||||
|
this.vodList = await this.parseVodShortListFromDoc($)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
let spider = new LoveMovie18Spider()
|
||||||
|
|
||||||
|
async function init(cfg) {
|
||||||
|
await spider.init(cfg)
|
||||||
|
}
|
||||||
|
|
||||||
|
async function home(filter) {
|
||||||
|
return await spider.home(filter)
|
||||||
|
}
|
||||||
|
|
||||||
|
async function homeVod() {
|
||||||
|
return await spider.homeVod()
|
||||||
|
}
|
||||||
|
|
||||||
|
async function category(tid, pg, filter, extend) {
|
||||||
|
return await spider.category(tid, pg, filter, extend)
|
||||||
|
}
|
||||||
|
|
||||||
|
async function detail(id) {
|
||||||
|
return await spider.detail(id)
|
||||||
|
}
|
||||||
|
|
||||||
|
async function play(flag, id, flags) {
|
||||||
|
return await spider.play(flag, id, flags)
|
||||||
|
}
|
||||||
|
|
||||||
|
async function search(wd, quick) {
|
||||||
|
return await spider.search(wd, quick)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function __jsEvalReturn() {
|
||||||
|
return {
|
||||||
|
init: init, home: home, homeVod: homeVod, category: category, detail: detail, play: play, search: search,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export {spider}
|
||||||
@@ -246,6 +246,10 @@ class Spider {
|
|||||||
getTypeDic(type_name, type_id) {
|
getTypeDic(type_name, type_id) {
|
||||||
return {"type_name": type_name, "type_id": type_id}
|
return {"type_name": type_name, "type_id": type_id}
|
||||||
}
|
}
|
||||||
|
getFliterDic(type_name, type_id) {
|
||||||
|
return {"n": type_name, "v": type_id}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
async getHtml(url = this.siteUrl, proxy = false, headers = this.getHeader()) {
|
async getHtml(url = this.siteUrl, proxy = false, headers = this.getHeader()) {
|
||||||
let html = await this.fetch(url, null, headers, false, false, 0, proxy)
|
let html = await this.fetch(url, null, headers, false, false, 0, proxy)
|
||||||
@@ -264,12 +268,12 @@ class Spider {
|
|||||||
return class_name_list
|
return class_name_list
|
||||||
}
|
}
|
||||||
|
|
||||||
async postReconnect(reqUrl, params, headers) {
|
async postReconnect(reqUrl, params, headers,postType,buffer) {
|
||||||
await this.jadeLog.error("请求失败,请检查url:" + reqUrl + ",两秒后重试")
|
await this.jadeLog.error("请求失败,请检查url:" + reqUrl + ",两秒后重试")
|
||||||
Utils.sleep(2)
|
Utils.sleep(2)
|
||||||
if (this.reconnectTimes < this.maxReconnectTimes) {
|
if (this.reconnectTimes < this.maxReconnectTimes) {
|
||||||
this.reconnectTimes = this.reconnectTimes + 1
|
this.reconnectTimes = this.reconnectTimes + 1
|
||||||
return await this.post(reqUrl, params, headers)
|
return await this.post(reqUrl, params, headers,postType,buffer)
|
||||||
} else {
|
} else {
|
||||||
await this.jadeLog.error("请求失败,重连失败")
|
await this.jadeLog.error("请求失败,重连失败")
|
||||||
return null
|
return null
|
||||||
@@ -335,10 +339,10 @@ class Spider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async post(reqUrl, params, headers, postType = "form") {
|
async post(reqUrl, params, headers, postType = "form",buffer = 0) {
|
||||||
let uri = new Uri(reqUrl);
|
let uri = new Uri(reqUrl);
|
||||||
let response = await req(uri.toString(), {
|
let response = await req(uri.toString(), {
|
||||||
method: "post", headers: headers, data: params, postType: postType
|
method: "post", headers: headers, data: params, postType: postType,buffer: buffer
|
||||||
});
|
});
|
||||||
if (response.code === 200 || response.code === undefined || response.code === 302) {
|
if (response.code === 200 || response.code === undefined || response.code === 302) {
|
||||||
// 重定向
|
// 重定向
|
||||||
@@ -348,11 +352,11 @@ class Spider {
|
|||||||
this.reconnectTimes = 0
|
this.reconnectTimes = 0
|
||||||
return response.content
|
return response.content
|
||||||
} else {
|
} else {
|
||||||
return await this.postReconnect(reqUrl, params, headers)
|
return await this.postReconnect(reqUrl, params, headers,postType,buffer)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
await this.jadeLog.error(`请求失败,请求url为:${reqUrl},回复内容为${JSON.stringify(response)}`)
|
await this.jadeLog.error(`请求失败,请求url为:${reqUrl},回复内容为${JSON.stringify(response)}`)
|
||||||
return await this.postReconnect(reqUrl, params, headers)
|
return await this.postReconnect(reqUrl, params, headers,postType,buffer)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import {__jsEvalReturn} from './cntv.js';
|
import {__jsEvalReturn} from './lovemovie18.js';
|
||||||
|
|
||||||
import * as Utils from "../lib/utils.js";
|
import * as Utils from "../lib/utils.js";
|
||||||
|
|
||||||
@@ -51,14 +51,14 @@ async function testMusicPlay(vodDetail) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function test() {
|
async function test() {
|
||||||
let siteKey = 'cntv';
|
let siteKey = 'lovemovie18';
|
||||||
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": "cntv",
|
"from": "lovemovie18",
|
||||||
"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"
|
||||||
}
|
}
|
||||||
@@ -69,24 +69,32 @@ async function test() {
|
|||||||
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", "1", undefined, {}));
|
|
||||||
console.debug(JSON.stringify(catePage));
|
|
||||||
|
|
||||||
// 测试详情
|
|
||||||
let detail1 = JSON.parse(await spider.detail("live-cctv2-https://app.cctv.com/special/appchannellogo/rectangle/l/cctv2.png?q=75"))
|
|
||||||
await testPlay(detail1)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 测试搜索
|
|
||||||
let search_page = JSON.parse(await spider.search("万相之王",false,1))
|
|
||||||
console.debug(JSON.stringify(search_page))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
107
cat/tjs/lib/TextEncoder.js
Normal file
107
cat/tjs/lib/TextEncoder.js
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
import Stream, { DEFAULT_ENCODING, getEncoding } from './text_decoder_index.js'
|
||||||
|
import { end_of_stream, finished, stringToCodePoints } from './text_decoder_utils.js'
|
||||||
|
import { encoders } from './table.js'
|
||||||
|
|
||||||
|
// 8.2 Interface TextEncoder
|
||||||
|
|
||||||
|
class TextEncoder {
|
||||||
|
/**
|
||||||
|
* @param {string=} label The label of the encoding. NONSTANDARD.
|
||||||
|
* @param {Object=} [options] NONSTANDARD.
|
||||||
|
*/
|
||||||
|
constructor(label, options = {}) {
|
||||||
|
// A TextEncoder object has an associated encoding and encoder.
|
||||||
|
|
||||||
|
/** @private */
|
||||||
|
this._encoding = null
|
||||||
|
/** @private @type {?Encoder} */
|
||||||
|
this._encoder = null
|
||||||
|
|
||||||
|
// Non-standard
|
||||||
|
/** @private @type {boolean} */
|
||||||
|
this._do_not_flush = false
|
||||||
|
/** @private @type {string} */
|
||||||
|
this._fatal = options['fatal'] ? 'fatal' : 'replacement'
|
||||||
|
|
||||||
|
// 2. Set enc's encoding to UTF-8's encoder.
|
||||||
|
if (options['NONSTANDARD_allowLegacyEncoding']) {
|
||||||
|
// NONSTANDARD behavior.
|
||||||
|
label = label !== undefined ? String(label) : DEFAULT_ENCODING
|
||||||
|
var encoding = getEncoding(label)
|
||||||
|
if (encoding === null || encoding.name === 'replacement')
|
||||||
|
throw RangeError('Unknown encoding: ' + label)
|
||||||
|
if (!encoders[encoding.name]) {
|
||||||
|
throw Error('Encoder not present.' +
|
||||||
|
' Did you forget to include encoding-indexes.js first?')
|
||||||
|
}
|
||||||
|
this._encoding = encoding
|
||||||
|
} else {
|
||||||
|
// Standard behavior.
|
||||||
|
this._encoding = getEncoding('utf-8')
|
||||||
|
|
||||||
|
if (label !== undefined && 'console' in global) {
|
||||||
|
console.warn('TextEncoder constructor called with encoding label, '
|
||||||
|
+ 'which is ignored.')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
get encoding() {
|
||||||
|
return this._encoding.name.toLowerCase()
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param {string=} opt_string The string to encode.
|
||||||
|
* @param {Object=} options
|
||||||
|
*/
|
||||||
|
encode(opt_string = '', options = {}) {
|
||||||
|
// NOTE: This option is nonstandard. None of the encodings
|
||||||
|
// permitted for encoding (i.e. UTF-8, UTF-16) are stateful when
|
||||||
|
// the input is a USVString so streaming is not necessary.
|
||||||
|
if (!this._do_not_flush)
|
||||||
|
this._encoder = encoders[this._encoding.name]({
|
||||||
|
fatal: this._fatal === 'fatal' })
|
||||||
|
this._do_not_flush = Boolean(options['stream'])
|
||||||
|
|
||||||
|
// 1. Convert input to a stream.
|
||||||
|
const input = new Stream(stringToCodePoints(opt_string))
|
||||||
|
|
||||||
|
// 2. Let output be a new stream
|
||||||
|
const output = []
|
||||||
|
|
||||||
|
/** @type {?(number|!Array.<number>)} */
|
||||||
|
var result
|
||||||
|
// 3. While true, run these substeps:
|
||||||
|
while (true) {
|
||||||
|
// 1. Let token be the result of reading from input.
|
||||||
|
var token = input.read()
|
||||||
|
if (token === end_of_stream)
|
||||||
|
break
|
||||||
|
// 2. Let result be the result of processing token for encoder,
|
||||||
|
// input, output.
|
||||||
|
result = this._encoder.handler(input, token)
|
||||||
|
if (result === finished)
|
||||||
|
break
|
||||||
|
if (Array.isArray(result))
|
||||||
|
output.push.apply(output, /**@type {!Array.<number>}*/(result))
|
||||||
|
else
|
||||||
|
output.push(result)
|
||||||
|
}
|
||||||
|
// TODO: Align with spec algorithm.
|
||||||
|
if (!this._do_not_flush) {
|
||||||
|
while (true) {
|
||||||
|
result = this._encoder.handler(input, input.read())
|
||||||
|
if (result === finished)
|
||||||
|
break
|
||||||
|
if (Array.isArray(result))
|
||||||
|
output.push.apply(output, /**@type {!Array.<number>}*/(result))
|
||||||
|
else
|
||||||
|
output.push(result)
|
||||||
|
}
|
||||||
|
this._encoder = null
|
||||||
|
}
|
||||||
|
// 3. If result is finished, convert output into a byte sequence,
|
||||||
|
// and then return a Uint8Array object wrapping an ArrayBuffer
|
||||||
|
// containing output.
|
||||||
|
return new Uint8Array(output)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export {TextEncoder}
|
||||||
@@ -77,7 +77,7 @@ class DanmuSpider {
|
|||||||
let uri = new Uri(url);
|
let uri = new Uri(url);
|
||||||
let response;
|
let response;
|
||||||
response = await req(uri.toString(), {method: "get", headers: headers, buffer: buffer, data: null})
|
response = await req(uri.toString(), {method: "get", headers: headers, buffer: buffer, data: null})
|
||||||
if (response.code === 200 || response.code === 302 || response.code === 301 || return_cookie) {
|
if (response.code === 201 || response.code === 200 || response.code === 302 || response.code === 301 || return_cookie) {
|
||||||
return await this.getResponse(reqUrl, params, headers, redirect_url, return_cookie, buffer, response)
|
return await this.getResponse(reqUrl, params, headers, redirect_url, return_cookie, buffer, response)
|
||||||
} else {
|
} else {
|
||||||
await this.jadeLog.error(`请求失败,失败原因为:状态码出错,请求url为:${uri},回复内容为:${JSON.stringify(response)}`)
|
await this.jadeLog.error(`请求失败,失败原因为:状态码出错,请求url为:${uri},回复内容为:${JSON.stringify(response)}`)
|
||||||
|
|||||||
32194
cat/tjs/lib/gbk_us.js
Normal file
32194
cat/tjs/lib/gbk_us.js
Normal file
File diff suppressed because it is too large
Load Diff
@@ -8,8 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
import {Crypto} from "./cat.js";
|
import {Crypto} from "./cat.js";
|
||||||
import {TextDecoder} from "./TextDecoder.js";
|
import {TextDecoder} from "./TextDecoder.js";
|
||||||
|
import {TextEncoder} from "./TextEncoder.js";
|
||||||
;
|
|
||||||
// import {TextDecoder} from "text-decoding";
|
// import {TextDecoder} from "text-decoding";
|
||||||
const deviceBrands = ['Huawei', 'Xiaomi'];
|
const deviceBrands = ['Huawei', 'Xiaomi'];
|
||||||
const deviceModels = [
|
const deviceModels = [
|
||||||
@@ -162,6 +161,11 @@ function decode(buffer, encode_type) {
|
|||||||
return decoder.decode(buffer)
|
return decoder.decode(buffer)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function encode(buffer, encode_type) {
|
||||||
|
let encoder = new TextEncoder(encode_type)
|
||||||
|
return encoder.encode(buffer)
|
||||||
|
}
|
||||||
|
|
||||||
function getHost(url) {
|
function getHost(url) {
|
||||||
let url_list = url.split("/")
|
let url_list = url.split("/")
|
||||||
return url_list[0] + "//" + url_list[2]
|
return url_list[0] + "//" + url_list[2]
|
||||||
@@ -304,5 +308,6 @@ export {
|
|||||||
randStr,
|
randStr,
|
||||||
randUUID,
|
randUUID,
|
||||||
formatContent,
|
formatContent,
|
||||||
formatUrl
|
formatUrl,
|
||||||
|
encode
|
||||||
};
|
};
|
||||||
@@ -307,6 +307,17 @@
|
|||||||
"playerType": 0,
|
"playerType": 0,
|
||||||
"type": 3
|
"type": 3
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"key": "lovemovie",
|
||||||
|
"name": "💕┃爱情电影网┃💕",
|
||||||
|
"api": "./js/lovemovie.js",
|
||||||
|
"timeout": 30,
|
||||||
|
"ext": {
|
||||||
|
"box": "CatOpen"
|
||||||
|
},
|
||||||
|
"playerType": 0,
|
||||||
|
"type": 3
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"key": "cilixiong",
|
"key": "cilixiong",
|
||||||
"name": "🐻┃磁力熊┃🐻",
|
"name": "🐻┃磁力熊┃🐻",
|
||||||
|
|||||||
@@ -306,6 +306,17 @@
|
|||||||
"playerType": 0,
|
"playerType": 0,
|
||||||
"type": 3
|
"type": 3
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"key": "lovemovie",
|
||||||
|
"name": "💕┃爱情电影网┃💕",
|
||||||
|
"api": "./js/lovemovie.js",
|
||||||
|
"timeout": 30,
|
||||||
|
"ext": {
|
||||||
|
"box": "TVBox"
|
||||||
|
},
|
||||||
|
"playerType": 0,
|
||||||
|
"type": 3
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"key": "cilixiong",
|
"key": "cilixiong",
|
||||||
"name": "🐻┃磁力熊┃🐻",
|
"name": "🐻┃磁力熊┃🐻",
|
||||||
|
|||||||
Reference in New Issue
Block a user