Skip to content

Commit

Permalink
* 解决图书和音乐加载失败的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jadehh committed Mar 29, 2024
1 parent 151a118 commit 8f721e1
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 25 deletions.
8 changes: 6 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
### 更新日志
### V1.0.4.0 - 2024-03-27
* 去除已失效链接
### V1.0.4.1 - 2024-03-29
* 解决图书和音乐加载失败的bug
----


<details onclose>

### V1.0.4.0 - 2024-03-27
* 去除已失效链接
----

### V1.0.3.9 - 2024-03-27
* 解决电影港首页无法加载图片的bug
* 去除已失效链接
Expand Down
32 changes: 21 additions & 11 deletions js/bqg_open.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {_} from '../lib/cat.js';
import * as Utils from "../lib/utils.js";
import {Spider} from "./spider.js";
import {VodShort} from "../lib/vod.js";
import {BookShort} from "../lib/book.js";
import {BookDetail, BookShort} from "../lib/book.js";

class BQQSpider extends Spider {
constructor() {
Expand All @@ -34,8 +34,18 @@ class BQQSpider extends Spider {
return "📚︎┃笔趣阁┃📚︎"
}

async spiderInit(inReq = null) {
if (inReq !== null) {
this.jsBase = await js2Proxy(inReq, "img", this.getHeader());
} else {
this.jsBase = await js2Proxy(true, this.siteType, this.siteKey, 'img/', this.getHeader());
}

}

async init(cfg) {
await super.init(cfg);
await this.spiderInit(null)
}

async parseVodShortListFromDoc($) {
Expand Down Expand Up @@ -68,13 +78,12 @@ class BQQSpider extends Spider {
}

async parseVodDetailFromDoc($, id) {
let book = {
book_name: $('[property$=book_name]')[0].attribs.content,
book_year: $('[property$=update_time]')[0].attribs.content,
book_director: $('[property$=author]')[0].attribs.content,
book_content: $('[property$=description]')[0].attribs.content,
book_pic: $($("[class=\"cover\"]")).find("img")[0].attribs.src
};
let bookDetail = new BookDetail()
bookDetail.book_name = $('[property$=book_name]')[0].attribs.content
bookDetail.book_year = $('[property$=update_time]')[0].attribs.content
bookDetail.book_director = $('[property$=author]')[0].attribs.content
bookDetail.book_content = $('[property$=description]')[0].attribs.content
bookDetail.book_pic = $($("[class=\"cover\"]")).find("img")[0].attribs.src
if (id !== undefined) {
$ = await this.getHtml(this.siteUrl + id + `list.html`);
let urls = [];
Expand All @@ -84,10 +93,10 @@ class BQQSpider extends Spider {
const link = l.attribs.href;
urls.push(name + '$' + link);
}
book.volumes = '全卷';
book.urls = urls.join('#');
bookDetail.volumes = '全卷';
bookDetail.urls = urls.join('#');
}
return book
return bookDetail

}

Expand Down Expand Up @@ -255,4 +264,5 @@ export function __jsEvalReturn() {
proxy: proxy
};
}

export {spider}
5 changes: 4 additions & 1 deletion js/spider.js
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,10 @@ class Spider {
await this.jadeLog.debug(`详情页面内容为:${this.result.detail(this.vodDetail)}`)
await this.jadeLog.info("详情页面解析完成", true)
this.vodDetail.vod_id = id
this.episodeObj = this.setEpisodeCache()
if (this.siteType === 3){
this.episodeObj = this.setEpisodeCache()
}

return this.result.detail(this.vodDetail)
} catch (e) {
await this.jadeLog.error("详情界面获取失败,失败原因为:" + e)
Expand Down
24 changes: 14 additions & 10 deletions js/testSpider.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {__jsEvalReturn} from './douban.js';
import {__jsEvalReturn} from './dj0898_book_open.js';
import * as Utils from "../lib/utils.js";


Expand Down Expand Up @@ -58,26 +58,30 @@ async function test() {
}
});


let classes = JSON.parse(await spider.home(true));
console.debug(JSON.stringify(classes))


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


// 测试搜索
let search_page = JSON.parse(await spider.search("小日子"))
console.debug(JSON.stringify(search_page));
// 测试详情
let detail1 = JSON.parse(await spider.detail("http://m.dj0898.com/dance/play/id/202181"))
await testPlay(detail1)

//测试分类列表
let catePage = JSON.parse(await spider.category("1", "1", undefined, {}));
console.debug(JSON.stringify(catePage));


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

let classes = JSON.parse(await spider.home(true));
console.debug(JSON.stringify(classes))


// 测试搜索
let search_page = JSON.parse(await spider.search("小日子"))
console.debug(JSON.stringify(search_page));



Expand Down
2 changes: 1 addition & 1 deletion lib/book.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class BookShort {
}
}

export class VodDetail extends BookShort {
export class BookDetail extends BookShort {
/**
* let book = {
* book_name: $('[property$=book_name]')[0].attribs.content,
Expand Down

0 comments on commit 8f721e1

Please sign in to comment.