mirror of
https://github.com/qist/tvbox.git
synced 2025-02-02 10:14:50 +08:00
update CAT
This commit is contained in:
parent
bdda250293
commit
3aa58c947b
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
bc8f18599a94263d004576e5506e8ca3
|
||||
576fae86365190bf5b44b5a5de56fde1
|
349
cat/dist/index.js
vendored
349
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 @@
|
||||
d420a0bc83dc0fa1e549de94127ad58d
|
||||
4393866d86b1531e38ec0699d5a57747
|
@ -18,6 +18,22 @@ class Doll extends Spider {
|
||||
this.siteUrl = "https://hongkongdollvideo.com"
|
||||
}
|
||||
|
||||
async spiderInit(inReq = null) {
|
||||
if (inReq !== null) {
|
||||
this.jsBase = await js2Proxy(inReq, "img", {});
|
||||
} else {
|
||||
this.jsBase = await js2Proxy(true, this.siteType, this.siteKey, 'img/', {});
|
||||
}
|
||||
}
|
||||
|
||||
async init(cfg) {
|
||||
await super.init(cfg);
|
||||
await this.spiderInit(null)
|
||||
}
|
||||
|
||||
async getHtml(url = this.siteUrl, proxy = false, headers = this.getHeader()) {
|
||||
return super.getHtml(url, true, headers);
|
||||
}
|
||||
|
||||
getName() {
|
||||
return "🔞┃玩偶姐姐┃🔞"
|
||||
@ -44,7 +60,13 @@ class Doll extends Spider {
|
||||
let videoInfoElements = $($(vodElement).find("[class=\"video-info\"]")).find("a")
|
||||
vodShort.vod_name = videoInfoElements[0].attribs["title"]
|
||||
vodShort.vod_remarks = $(videoInfoElements[1]).text()
|
||||
vodShort.vod_pic = $(vodElement).find("img")[0].attribs["data-src"]
|
||||
let pic = $(vodElement).find("img")[0].attribs["data-src"]
|
||||
if (this.catOpenStatus) {
|
||||
vodShort.vod_pic = this.jsBase + Utils.base64Encode(pic)
|
||||
} else {
|
||||
vodShort.vod_pic = pic
|
||||
}
|
||||
|
||||
vod_list.push(vodShort)
|
||||
}
|
||||
return vod_list
|
||||
@ -55,10 +77,16 @@ class Doll extends Spider {
|
||||
let vodElement = $("[class=\"container-fluid\"]")
|
||||
vodDetail.vod_name = $($(vodElement).find("[class=\"page-title\"]")[0]).text()
|
||||
vodDetail.vod_remarks = $(vodElement).find("[class=\"tag my-1 text-center\"]")[0].attribs["href"].replaceAll("/", "")
|
||||
vodDetail.vod_pic = $(vodElement).find("video")[0].attribs["poster"]
|
||||
let pic = $(vodElement).find("video")[0].attribs["poster"]
|
||||
if (this.catOpenStatus) {
|
||||
vodDetail.vod_pic = this.jsBase + Utils.base64Encode(pic)
|
||||
} else {
|
||||
vodDetail.vod_pic = pic
|
||||
}
|
||||
let html = $.html()
|
||||
let voteTag = Utils.getStrByRegex(/var voteTag="(.*?)";/g, html)
|
||||
let videoInfo = JSON.parse(Utils.getStrByRegex(/<script type="application\/ld\+json">(.*?)<\/script>/g, html))
|
||||
// let videoInfoStr = Utils.getStrByRegex(/<script type="application\/ld\+json">(.*?)<\/script>/g, html)
|
||||
// let videoInfo = JSON.parse(videoInfoStr)
|
||||
//
|
||||
// try {
|
||||
// let play_url_1 = await this.fetch(videoInfo["contentUrl"], null, this.getHeader())
|
||||
@ -81,62 +109,56 @@ class Doll extends Spider {
|
||||
}
|
||||
|
||||
async setClasses() {
|
||||
let html = await this.fetch(this.siteUrl, null, this.getHeader())
|
||||
if (html !== null) {
|
||||
let $ = load(html)
|
||||
let navElements = $("[class=\"list-unstyled topnav-menu d-flex d-lg-block align-items-center justify-content-center flex-fill topnav-menu-left m-0\"]").find("li")
|
||||
let index = 1
|
||||
let class_id = index.toString()
|
||||
this.classes = []
|
||||
this.classes.push({"type_name": "首页", "type_id": "1"})
|
||||
this.filterObj[class_id] = []
|
||||
for (const navElement of navElements) {
|
||||
let type_list = $(navElement).text().split("\n")
|
||||
let valueElements = $(navElement).find("a")
|
||||
let valueList = [{"n": "全部", "v": class_id}]
|
||||
let type_id = index.toString()
|
||||
for (const valueElement of valueElements) {
|
||||
let title = $(valueElement).text().replaceAll("\n", "")
|
||||
let href = valueElement.attribs["href"]
|
||||
if (href !== undefined) {
|
||||
valueList.push({"n": title, "v": href})
|
||||
}
|
||||
}
|
||||
type_list = type_list.filter(element => element !== "");
|
||||
this.filterObj[class_id].push({"key": type_id, "name": type_list[0], "value": valueList})
|
||||
|
||||
//下面这段是为了切割使用
|
||||
// let new_value_list = []
|
||||
// for (let i = 0; i < valueList.length; i++) {
|
||||
// new_value_list.push(valueList[i])
|
||||
// if (i % 8 === 0 && i !== 0) {
|
||||
// this.filterObj[class_id].push({"key": type_id, "name": type_list[0], "value": new_value_list})
|
||||
// new_value_list = []
|
||||
// }
|
||||
// }
|
||||
// this.filterObj[class_id].push({"key": type_id, "name": type_list[0], "value": new_value_list})
|
||||
|
||||
}
|
||||
let menuElements = $("[id=\"side-menu\"]").find("li")
|
||||
for (const menuElement of menuElements) {
|
||||
let type_id = $(menuElement).find("a")[0].attribs["href"]
|
||||
if (type_id !== undefined && type_id.indexOf(this.siteUrl) > -1) {
|
||||
let type_dic = {
|
||||
"type_name": $(menuElement).text(), "type_id": type_id
|
||||
}
|
||||
this.classes.push(type_dic)
|
||||
let $ = await this.getHtml(this.siteUrl)
|
||||
let navElements = $("[class=\"list-unstyled topnav-menu d-flex d-lg-block align-items-center justify-content-center flex-fill topnav-menu-left m-0\"]").find("li")
|
||||
let index = 1
|
||||
let class_id = index.toString()
|
||||
this.classes = []
|
||||
this.classes.push({"type_name": "首页", "type_id": "1"})
|
||||
this.filterObj[class_id] = []
|
||||
for (const navElement of navElements) {
|
||||
let type_list = $(navElement).text().split("\n")
|
||||
let valueElements = $(navElement).find("a")
|
||||
let valueList = [{"n": "全部", "v": class_id}]
|
||||
let type_id = index.toString()
|
||||
for (const valueElement of valueElements) {
|
||||
let title = $(valueElement).text().replaceAll("\n", "")
|
||||
let href = valueElement.attribs["href"]
|
||||
if (href !== undefined) {
|
||||
valueList.push({"n": title, "v": href})
|
||||
}
|
||||
}
|
||||
type_list = type_list.filter(element => element !== "");
|
||||
this.filterObj[class_id].push({"key": type_id, "name": type_list[0], "value": valueList})
|
||||
|
||||
//下面这段是为了切割使用
|
||||
// let new_value_list = []
|
||||
// for (let i = 0; i < valueList.length; i++) {
|
||||
// new_value_list.push(valueList[i])
|
||||
// if (i % 8 === 0 && i !== 0) {
|
||||
// this.filterObj[class_id].push({"key": type_id, "name": type_list[0], "value": new_value_list})
|
||||
// new_value_list = []
|
||||
// }
|
||||
// }
|
||||
// this.filterObj[class_id].push({"key": type_id, "name": type_list[0], "value": new_value_list})
|
||||
|
||||
}
|
||||
let menuElements = $("[id=\"side-menu\"]").find("li")
|
||||
for (const menuElement of menuElements) {
|
||||
let type_id = $(menuElement).find("a")[0].attribs["href"]
|
||||
if (type_id !== undefined && type_id.indexOf(this.siteUrl) > -1) {
|
||||
let type_dic = {
|
||||
"type_name": $(menuElement).text(), "type_id": type_id
|
||||
}
|
||||
this.classes.push(type_dic)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
async setHomeVod() {
|
||||
let html = await this.fetch(this.siteUrl, null, this.getHeader())
|
||||
if (html != null) {
|
||||
let $ = load(html)
|
||||
this.homeVodList = await this.parseVodShortListFromDoc($)
|
||||
}
|
||||
let $ = await this.getHtml(this.siteUrl)
|
||||
this.homeVodList = await this.parseVodShortListFromDoc($)
|
||||
}
|
||||
|
||||
async setCategory(tid, pg, filter, extend) {
|
||||
@ -153,20 +175,14 @@ class Doll extends Spider {
|
||||
cateUrl = this.siteUrl
|
||||
}
|
||||
this.limit = 36
|
||||
let html = await this.fetch(cateUrl, null, this.getHeader())
|
||||
if (html != null) {
|
||||
let $ = load(html)
|
||||
this.vodList = await this.parseVodShortListFromDoc($)
|
||||
}
|
||||
let $ = await this.getHtml(cateUrl)
|
||||
this.vodList = await this.parseVodShortListFromDoc($)
|
||||
}
|
||||
|
||||
async setDetail(id) {
|
||||
let html = await this.fetch(id, null, this.getHeader())
|
||||
if (html != null) {
|
||||
let $ = load(html)
|
||||
let key = Utils.getStrByRegex(/video\/(\w+).html/, id)
|
||||
this.vodDetail = await this.parseVodDetailFromDoc($, key)
|
||||
}
|
||||
let $ = await this.getHtml(id)
|
||||
let key = Utils.getStrByRegex(/video\/(\w+).html/, id)
|
||||
this.vodDetail = await this.parseVodDetailFromDoc($, key)
|
||||
}
|
||||
|
||||
async setPlay(flag, id, flags) {
|
||||
@ -176,11 +192,12 @@ class Doll extends Spider {
|
||||
|
||||
async setSearch(wd, quick) {
|
||||
let searchUrl = this.siteUrl + "search/" + encodeURIComponent(wd)
|
||||
let html = await this.fetch(searchUrl, null, this.getHeader())
|
||||
if (html !== null) {
|
||||
let $ = load(html)
|
||||
this.vodList = await this.parseVodShortListFromDoc($)
|
||||
}
|
||||
let $ = await this.getHtml(searchUrl)
|
||||
this.vodList = await this.parseVodShortListFromDoc($)
|
||||
}
|
||||
|
||||
async proxy(segments, headers) {
|
||||
return super.proxy(segments, headers);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,20 @@ class JableTVSpider extends Spider {
|
||||
|
||||
}
|
||||
|
||||
async spiderInit(inReq = null) {
|
||||
if (inReq !== null) {
|
||||
this.jsBase = await js2Proxy(inReq, "img", {});
|
||||
} else {
|
||||
this.jsBase = await js2Proxy(true, this.siteType, this.siteKey, 'img/', {});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async init(cfg) {
|
||||
await super.init(cfg);
|
||||
await this.spiderInit(null)
|
||||
}
|
||||
|
||||
getAppName() {
|
||||
return "Jable"
|
||||
}
|
||||
@ -26,6 +40,7 @@ class JableTVSpider extends Spider {
|
||||
getName() {
|
||||
return "🔞┃Jable┃🔞"
|
||||
}
|
||||
|
||||
getJSName() {
|
||||
return "jable"
|
||||
}
|
||||
@ -43,6 +58,10 @@ class JableTVSpider extends Spider {
|
||||
return header
|
||||
}
|
||||
|
||||
async getHtml(url = this.siteUrl, proxy = false, headers = this.getHeader()) {
|
||||
return super.getHtml(url, true, headers);
|
||||
}
|
||||
|
||||
async setClasses() {
|
||||
let $ = await this.getHtml(this.siteUrl)
|
||||
let navElements = $("[class=\"title-box\"]")
|
||||
@ -148,19 +167,27 @@ class JableTVSpider extends Spider {
|
||||
let vodElements = $("div.video-img-box")
|
||||
for (const element of vodElements) {
|
||||
let vodShort = new VodShort()
|
||||
vodShort.vod_pic = $(element).find("img").attr("data-src");
|
||||
let url = $(element).find("a").attr("href");
|
||||
vodShort.vod_id = url.split("/")[4];
|
||||
vodShort.vod_name = url.split("/")[4];
|
||||
let remarks_list = $($(element).find("[class=\"sub-title\"]")).text().split("\n")
|
||||
if (remarks_list.length > 1){
|
||||
vodShort.vod_remarks = remarks_list[1].replaceAll(" ", "").replaceAll("\t", "")
|
||||
}else{
|
||||
vodShort.vod_remarks = "精选"
|
||||
}
|
||||
if (!_.isEmpty(vodShort.vod_pic) && vodShort.vod_remarks !== "[限時優惠]只需1元即可無限下載"){
|
||||
vod_list.push(vodShort);
|
||||
let vod_pic = $(element).find("img").attr("data-src")
|
||||
if (vod_pic !== undefined) {
|
||||
if (this.catOpenStatus) {
|
||||
vodShort.vod_pic = this.jsBase + Utils.base64Encode(vod_pic)
|
||||
} else {
|
||||
vodShort.vod_pic = vod_pic
|
||||
}
|
||||
let url = $(element).find("a").attr("href");
|
||||
vodShort.vod_id = url.split("/")[4];
|
||||
vodShort.vod_name = url.split("/")[4];
|
||||
let remarks_list = $($(element).find("[class=\"sub-title\"]")).text().split("\n")
|
||||
if (remarks_list.length > 1) {
|
||||
vodShort.vod_remarks = remarks_list[1].replaceAll(" ", "").replaceAll("\t", "")
|
||||
} else {
|
||||
vodShort.vod_remarks = "精选"
|
||||
}
|
||||
if (!_.isEmpty(vodShort.vod_pic) && vodShort.vod_remarks !== "[限時優惠]只需1元即可無限下載") {
|
||||
vod_list.push(vodShort);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return vod_list
|
||||
}
|
||||
@ -169,9 +196,14 @@ class JableTVSpider extends Spider {
|
||||
let vodDetail = new VodDetail();
|
||||
let leftElement = $("[class=\"header-left\"]")
|
||||
vodDetail.vod_name = $($(leftElement).find("h4")).text();
|
||||
vodDetail.vod_pic = Utils.getStrByRegex(/<video poster="(.*?)" id=/, $.html())
|
||||
let vod_pic = Utils.getStrByRegex(/<video poster="(.*?)" id=/, $.html())
|
||||
if (this.catOpenStatus) {
|
||||
vodDetail.vod_pic = this.jsBase + Utils.base64Encode(vod_pic)
|
||||
} else {
|
||||
vodDetail.vod_pic = vod_pic
|
||||
}
|
||||
vodDetail.vod_year = $($("[class=\"inactive-color\"]")).text()
|
||||
let episodeName = $($("[class=\"header-right d-none d-md-block\"] > h6")).text().replaceAll("\n", "").replaceAll("●","")
|
||||
let episodeName = $($("[class=\"header-right d-none d-md-block\"] > h6")).text().replaceAll("\n", "").replaceAll("●", "")
|
||||
let vodItems = []
|
||||
let episodeUrl = Utils.getStrByRegex(/var hlsUrl = '(.*?)';/, $.html())
|
||||
vodItems.push(episodeName + "$" + episodeUrl)
|
||||
@ -271,4 +303,5 @@ export function __jsEvalReturn() {
|
||||
proxy: proxy
|
||||
};
|
||||
}
|
||||
|
||||
export {spider}
|
@ -73,7 +73,7 @@ class Result {
|
||||
"format": this.format,
|
||||
"subs": this.subs,
|
||||
"danmaku": this.danmaku,
|
||||
"extra":this.extra,
|
||||
"extra": this.extra,
|
||||
"jx": this.jx
|
||||
})
|
||||
} else {
|
||||
@ -83,14 +83,16 @@ class Result {
|
||||
"header": this.header,
|
||||
"format": this.format,
|
||||
"subs": this.subs,
|
||||
"extra":this.extra,
|
||||
"extra": this.extra,
|
||||
"jx": this.jx
|
||||
})
|
||||
}
|
||||
}
|
||||
playTxt(url){
|
||||
|
||||
playTxt(url) {
|
||||
return url
|
||||
}
|
||||
|
||||
errorCategory(error_message) {
|
||||
let vodShort = new VodShort()
|
||||
vodShort.vod_name = "错误:打开无效"
|
||||
@ -245,8 +247,8 @@ class Spider {
|
||||
return {"type_name": type_name, "type_id": type_id}
|
||||
}
|
||||
|
||||
async getHtml(url = this.siteUrl, headers = this.getHeader()) {
|
||||
let html = await this.fetch(url, null, headers)
|
||||
async getHtml(url = this.siteUrl, proxy = false, headers = this.getHeader()) {
|
||||
let html = await this.fetch(url, null, headers, false, false, 0, proxy)
|
||||
if (!_.isEmpty(html)) {
|
||||
return load(html)
|
||||
} else {
|
||||
@ -278,14 +280,14 @@ class Spider {
|
||||
return {"User-Agent": Utils.CHROME, "Referer": this.siteUrl + "/"};
|
||||
}
|
||||
|
||||
async getResponse(reqUrl, params, headers, redirect_url, return_cookie, buffer, response) {
|
||||
async getResponse(reqUrl, params, headers, redirect_url, return_cookie, buffer, response,proxy) {
|
||||
{
|
||||
if (response.headers["location"] !== undefined) {
|
||||
if (redirect_url) {
|
||||
await this.jadeLog.debug(`返回重定向连接:${response.headers["location"]}`)
|
||||
return response.headers["location"]
|
||||
} else {
|
||||
return this.fetch(response.headers["location"], params, headers, redirect_url, return_cookie, buffer)
|
||||
return this.fetch(response.headers["location"], params, headers, redirect_url, return_cookie, buffer,proxy)
|
||||
}
|
||||
} else if (response.content.length > 0) {
|
||||
this.reconnectTimes = 0
|
||||
@ -299,13 +301,13 @@ class Spider {
|
||||
return response.content
|
||||
} else {
|
||||
await this.jadeLog.error(`请求失败,请求url为:${reqUrl},回复内容为:${JSON.stringify(response)}`)
|
||||
return await this.reconnnect(reqUrl, params, headers, redirect_url, return_cookie, buffer)
|
||||
return await this.reconnnect(reqUrl, params, headers, redirect_url, return_cookie, buffer,proxy)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async fetch(reqUrl, params, headers, redirect_url = false, return_cookie = false, buffer = 0) {
|
||||
async fetch(reqUrl, params, headers, redirect_url = false, return_cookie = false, buffer = 0, proxy = false) {
|
||||
let data = Utils.objectToStr(params)
|
||||
let url = reqUrl
|
||||
if (!_.isEmpty(data)) {
|
||||
@ -315,13 +317,13 @@ class Spider {
|
||||
let response;
|
||||
if (redirect_url) {
|
||||
response = await req(uri.toString(), {
|
||||
method: "get", headers: headers, buffer: buffer, data: null, redirect: 2
|
||||
method: "get", headers: headers, buffer: buffer, data: null, redirect: 2, proxy: proxy
|
||||
})
|
||||
} else {
|
||||
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,proxy:proxy});
|
||||
}
|
||||
if (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,proxy)
|
||||
} else {
|
||||
await this.jadeLog.error(`请求失败,失败原因为:状态码出错,请求url为:${uri},回复内容为:${JSON.stringify(response)}`)
|
||||
return await this.reconnnect(reqUrl, params, headers, redirect_url, return_cookie, buffer)
|
||||
@ -693,10 +695,12 @@ class Spider {
|
||||
|
||||
async getImg(url, headers) {
|
||||
let resp;
|
||||
let use_proxy = false // 使用代理不需要加headers
|
||||
if (_.isEmpty(headers)) {
|
||||
headers = {Referer: url, 'User-Agent': Utils.CHROME}
|
||||
use_proxy = true
|
||||
}
|
||||
resp = await req(url, {buffer: 2, headers: headers});
|
||||
resp = await req(url, {buffer: 2, headers: headers,proxy:use_proxy});
|
||||
try {
|
||||
Utils.base64Decode(resp.content)
|
||||
await this.jadeLog.error(`图片代理获取失败,重连失败`, true)
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {__jsEvalReturn} from './bilibili.js';
|
||||
import {__jsEvalReturn} from './jable.js';
|
||||
import * as Utils from "../lib/utils.js";
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user