diff --git a/docs/anime.md b/docs/anime.md index 2485104cb..c17f48c87 100644 --- a/docs/anime.md +++ b/docs/anime.md @@ -554,7 +554,7 @@ Sources ## 包子漫画 -#### 订阅漫画 +### 订阅漫画 diff --git a/lib/v2/baozimh/index.js b/lib/v2/baozimh/index.js index b8560c518..6e4e2bcec 100644 --- a/lib/v2/baozimh/index.js +++ b/lib/v2/baozimh/index.js @@ -9,11 +9,12 @@ module.exports = async (ctx) => { const name = ctx.params.name; const url = `${rootUrl}/comic/${name}`; - const response = await got.get(url); + const response = await got(url); const $ = cheerio.load(response.data); const comicTitle = $('div > div.pure-u-1-1.pure-u-sm-2-3.pure-u-md-3-4 > div > h1').text(); const list = $('#layout > div.comics-detail > div:nth-child(3) > div > div:nth-child(4) > div') - .map((_, item) => { + .toArray() + .map((item) => { const title = $(item).find('span').text(); const link = rootUrl + $(item).find('a').attr('href'); @@ -21,25 +22,18 @@ module.exports = async (ctx) => { title, link, }; - }) - .get(); + }); const items = await Promise.all( list.map((item) => ctx.cache.tryGet(item.link, async () => { - const directUrlParams = new URLSearchParams(new URL(item.link).search); - const comicId = directUrlParams.get('comic_id'); - const sectionSolt = directUrlParams.get('section_slot'); - const chapterSlot = directUrlParams.get('chapter_slot'); - const descUrl = `https://www.webmota.com/comic/chapter/${comicId}/${sectionSolt}_${chapterSlot}.html`; - - const detailResponse = await got.get(descUrl); + const detailResponse = await got(item.link); const $ = cheerio.load(detailResponse.data); item.description = art(path.join(__dirname, 'templates/desc.art'), { - imgUrlList: $('section.comic-contain') + imgUrlList: $('.comic-contain') .find('amp-img') - .map((_, item) => $(item).attr('src')) - .get(), + .toArray() + .map((item) => $(item).attr('src')), }); return item; @@ -49,6 +43,7 @@ module.exports = async (ctx) => { ctx.state.data = { title: `包子漫画-${comicTitle}`, + description: $('.comics-detail__desc').text(), link: url, item: items, };