Add 包子漫画 (#8762)

This commit is contained in:
Fatpandac 2022-01-23 04:04:10 +08:00 committed by GitHub
parent 45aeb8e7a3
commit 548136c56a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 74 additions and 0 deletions

View File

@ -331,6 +331,12 @@ Sources
<Route author="zfanta" example="/webtoons/naver/651673" path="/webtoons/naver/:titleId" :paramsDesc="['titleId']" />
## 包子漫画
#### 订阅漫画
<Route author="Fatpandac" example="/baozimh/comic/guowangpaiming-shiricaofu" path="/baozimh/comic/:name" :paramsDesc="['漫画名称,在漫画链接可以得到(`comic/` 后的那段)']"/>
## 嘀哩嘀哩 - dilidili
### 嘀哩嘀哩番剧更新

49
lib/v2/baozimh/index.js Normal file
View File

@ -0,0 +1,49 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const rootUrl = 'https://www.baozimh.com';
module.exports = async (ctx) => {
const name = ctx.params.name;
const url = `${rootUrl}/comic/${name}`;
const response = await got.get(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(2) > div')
.map((_, item) => {
const title = $(item).find('span').text();
const link = rootUrl + $(item).find('a').attr('href');
return {
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 $ = cheerio.load(detailResponse.data);
const desc = $('div.comic-contain > amp-img > noscript').text();
item.description = desc;
return item;
})
)
);
ctx.state.data = {
title: `包子漫画-${comicTitle}`,
link: url,
item: items,
};
};

View File

@ -0,0 +1,3 @@
module.exports = {
'/comic/:name': ['Fatpandac'],
};

13
lib/v2/baozimh/radar.js Normal file
View File

@ -0,0 +1,13 @@
module.exports = {
'baozimh.com': {
_name: '包子漫画',
www: [
{
title: '订阅漫画',
docs: 'https://docs.rsshub.app/multimedia.html#bandcamp-upcoming-live-streams',
source: '/comic/:name',
target: '/baozimh/comic/:name',
},
],
},
};

3
lib/v2/baozimh/router.js Normal file
View File

@ -0,0 +1,3 @@
module.exports = function (router) {
router.get('/comic/:name', require('./index'));
};