From 548136c56a992dff350c049ddf8939a9eb01b342 Mon Sep 17 00:00:00 2001
From: Fatpandac <1779196284@qq.com>
Date: Sun, 23 Jan 2022 04:04:10 +0800
Subject: [PATCH] =?UTF-8?q?Add=20=E5=8C=85=E5=AD=90=E6=BC=AB=E7=94=BB=20(#?=
=?UTF-8?q?8762)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
docs/anime.md | 6 +++++
lib/v2/baozimh/index.js | 49 ++++++++++++++++++++++++++++++++++++
lib/v2/baozimh/maintainer.js | 3 +++
lib/v2/baozimh/radar.js | 13 ++++++++++
lib/v2/baozimh/router.js | 3 +++
5 files changed, 74 insertions(+)
create mode 100644 lib/v2/baozimh/index.js
create mode 100644 lib/v2/baozimh/maintainer.js
create mode 100644 lib/v2/baozimh/radar.js
create mode 100644 lib/v2/baozimh/router.js
diff --git a/docs/anime.md b/docs/anime.md
index 77d4ee967..9675d9fd2 100644
--- a/docs/anime.md
+++ b/docs/anime.md
@@ -331,6 +331,12 @@ Sources
+## 包子漫画
+
+#### 订阅漫画
+
+
+
## 嘀哩嘀哩 - dilidili
### 嘀哩嘀哩番剧更新
diff --git a/lib/v2/baozimh/index.js b/lib/v2/baozimh/index.js
new file mode 100644
index 000000000..ff9c5f164
--- /dev/null
+++ b/lib/v2/baozimh/index.js
@@ -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,
+ };
+};
diff --git a/lib/v2/baozimh/maintainer.js b/lib/v2/baozimh/maintainer.js
new file mode 100644
index 000000000..8284b2efb
--- /dev/null
+++ b/lib/v2/baozimh/maintainer.js
@@ -0,0 +1,3 @@
+module.exports = {
+ '/comic/:name': ['Fatpandac'],
+};
diff --git a/lib/v2/baozimh/radar.js b/lib/v2/baozimh/radar.js
new file mode 100644
index 000000000..984a292ec
--- /dev/null
+++ b/lib/v2/baozimh/radar.js
@@ -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',
+ },
+ ],
+ },
+};
diff --git a/lib/v2/baozimh/router.js b/lib/v2/baozimh/router.js
new file mode 100644
index 000000000..2374d512a
--- /dev/null
+++ b/lib/v2/baozimh/router.js
@@ -0,0 +1,3 @@
+module.exports = function (router) {
+ router.get('/comic/:name', require('./index'));
+};