Skip to content

Commit

Permalink
* 优化玩偶系列搜索结果,优化弹幕加载过慢的bug,优化荐片图片加载的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jadehh committed May 11, 2024
1 parent f6ab349 commit 89d71ac
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 40 deletions.
2 changes: 1 addition & 1 deletion js/aiyingshi.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class AiYingShiSpider extends Spider {
vodShort.vod_id = $(item).find(".video-serial")[0].attribs.href;
vodShort.vod_name = $(item).find(".video-serial")[0].attribs.title;
vodShort.vod_pic = $(item).find(".module-item-pic > img")[0].attribs['data-src']
vodShort.vod_remarks = '';
vodShort.vod_remarks = $($(item).find(".video-serial")[0]).text();
vod_list.push(vodShort);
}
return vod_list
Expand Down
25 changes: 6 additions & 19 deletions js/jianpian.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,28 +66,15 @@ class JianPianSpider extends Spider {
let vodShort = new VodShort();
vodShort.vod_id = data["id"]
if (data["path"] !== undefined) {
if (!this.catOpenStatus) {
vodShort.vod_pic = data["path"] + "@Referer=www.jianpianapp.com@User-Agent=jianpian-version353@JPAUTH=y261ow7kF2dtzlxh1GS9EB8nbTxNmaK/QQIAjctlKiEv"
} else {
vodShort.vod_pic = this.jsBase + Utils.base64Encode(data["path"])
}
vodShort.vod_pic = this.jsBase + Utils.base64Encode(data["path"])
} else {
if (!this.catOpenStatus) {
vodShort.vod_pic = data["thumbnail"] + "@Referer=www.jianpianapp.com@User-Agent=jianpian-version353@JPAUTH=y261ow7kF2dtzlxh1GS9EB8nbTxNmaK/QQIAjctlKiE"

} else {
vodShort.vod_pic = this.jsBase + Utils.base64Encode(data["thumbnail"])
}
vodShort.vod_pic = this.jsBase + Utils.base64Encode(data["thumbnail"])
}
vodShort.vod_name = data["title"]
if (this.catOpenStatus) {
vodShort.vod_remarks = `评分:${data["score"]}`
} else {
if (data["playlist"] !== undefined) {
vodShort.vod_remarks = `评分:${data["score"]}` + " " + data["playlist"]["title"]
} else {
vodShort.vod_remarks = `评分:${data["score"]}`
}
if (data["mask"] !== undefined){
vodShort.vod_remarks = data["mask"]
}else{
vodShort.vod_remarks = data["playlist"]["title"]
}
vod_list.push(vodShort)
}
Expand Down
31 changes: 17 additions & 14 deletions js/testSpider.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {__jsEvalReturn} from './bqg_open.js';
import {__jsEvalReturn} from './jianpian.js';

import * as Utils from "../lib/utils.js";

Expand Down Expand Up @@ -51,14 +51,14 @@ async function testMusicPlay(vodDetail) {
}

async function test() {
let siteKey = 'bqg_open';
let siteType = 10;
let siteKey = 'jianpian';
let siteType = 3;
await spider.init({
skey: siteKey, stype: siteType, ext: {
"token": "6827db23e5474d02a07fd7431d3d5a5a",
"box": "CatOpen",
"token": "51427b95ab9d47a6921a27951ebd3f1e",
"box": "TV",
"code": "1",
"from": "liujiushu",
"from": "jianpian",
"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"
}
Expand All @@ -68,23 +68,26 @@ async function test() {
console.debug(JSON.stringify(classes))


// 测试搜索
let search_page = JSON.parse(await spider.search("甄嬛传", false, 1))
console.debug(JSON.stringify(search_page))


// 测试详情
let detail1 = JSON.parse(await spider.detail("1872"))
await testPlay(detail1)

//测试首页列表
let homeVod = JSON.parse(await spider.homeVod())
console.debug(JSON.stringify(homeVod));


// 测试详情
let detail1 = JSON.parse(await spider.detail("/html/31575/"))
await testMusicPlay(detail1)

// 测试分类
let catePage = JSON.parse(await spider.category("/novel/class/lianzai", "1", undefined, {"sort":"/novel/class/lianzai_efgh"}));
let catePage = JSON.parse(await spider.category("2", "1", undefined, {}));
console.debug(JSON.stringify(catePage))


// 测试搜索
let search_page = JSON.parse(await spider.search("完美世界", false, 1))
console.debug(JSON.stringify(search_page))




Expand Down
2 changes: 1 addition & 1 deletion js/wogg.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class WoggSpider extends Spider {
vodShort.vod_id = $(item).find(".video-serial")[0].attribs.href;
vodShort.vod_name = $(item).find(".video-serial")[0].attribs.title;
vodShort.vod_pic = $(item).find(".module-item-pic > img")[0].attribs['data-src'];
vodShort.vod_remarks = '';
vodShort.vod_remarks = $($(item).find(".video-serial")[0]).text();
vod_list.push(vodShort);
}
return vod_list
Expand Down
17 changes: 12 additions & 5 deletions lib/danmuSpider.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,18 @@ class DanmuSpider {
}

async downloadDanmu(url) {
let json = JSON.parse(await this.fetch(url, null, this.getHeader()))
let xml = parseXML(json)
let params = {"do": "set", "key": "danmu", "value": xml}
await req("http://127.0.0.1:9978/cache", {method: "post", data: params, postType: "form-data"});
return "http://127.0.0.1:9978/cache?do=get&key=danmu"
// 如果没有找到弹幕的话,容易导致卡在这一步,从而导致结果加载不出来
let response = await req(url,{headers:this.getHeader()})
if (response.code === 200){
let xml = parseXML(JSON.parse(response.content))
let params = {"do": "set", "key": "danmu", "value": xml}
await req("http://127.0.0.1:9978/cache", {method: "post", data: params, postType: "form-data"});
return "http://127.0.0.1:9978/cache?do=get&key=danmu"
}
else{
this.jadeLog.error(`弹幕请求失败,返回结果为:${JSON.stringify(response)}`)
return ""
}
}

async search(vodDetail, episodeId) {
Expand Down

0 comments on commit 89d71ac

Please sign in to comment.