diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9a56d74f..785bfa2a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,11 +1,15 @@ ### 更新日志 -### V1.0.4.0 - 2024-03-27 -* 去除已失效链接 +### V1.0.4.1 - 2024-03-29 +* 解决图书和音乐加载失败的bug ----
+### V1.0.4.0 - 2024-03-27 +* 去除已失效链接 +---- + ### V1.0.3.9 - 2024-03-27 * 解决电影港首页无法加载图片的bug * 去除已失效链接 diff --git a/js/bqg_open.js b/js/bqg_open.js index f9402fb9..1867fe9b 100644 --- a/js/bqg_open.js +++ b/js/bqg_open.js @@ -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() { @@ -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($) { @@ -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 = []; @@ -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 } @@ -255,4 +264,5 @@ export function __jsEvalReturn() { proxy: proxy }; } + export {spider} \ No newline at end of file diff --git a/js/spider.js b/js/spider.js index 619c94d9..3e798f88 100644 --- a/js/spider.js +++ b/js/spider.js @@ -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) diff --git a/js/testSpider.js b/js/testSpider.js index 53487b6f..2047b539 100644 --- a/js/testSpider.js +++ b/js/testSpider.js @@ -1,4 +1,4 @@ -import {__jsEvalReturn} from './douban.js'; +import {__jsEvalReturn} from './dj0898_book_open.js'; import * as Utils from "../lib/utils.js"; @@ -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)); diff --git a/lib/book.js b/lib/book.js index 5addd929..3adda037 100644 --- a/lib/book.js +++ b/lib/book.js @@ -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,