From a8afe762a252feaf61bc963cb3e65a3f795f60e4 Mon Sep 17 00:00:00 2001
From: MachX <28209092+machsix@users.noreply.github.com>
Date: Wed, 8 May 2019 12:29:38 -0400
Subject: [PATCH] =?UTF-8?q?feat:=20=E5=92=9A=E6=BC=AB=20(#2081)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
docs/anime.md | 4 +++
lib/router.js | 2 ++
lib/routes/dongmanmanhua/comic.js | 45 +++++++++++++++++++++++++++++++
3 files changed, 51 insertions(+)
create mode 100644 lib/routes/dongmanmanhua/comic.js
diff --git a/docs/anime.md b/docs/anime.md
index faaf8a95cd..827716fbf3 100644
--- a/docs/anime.md
+++ b/docs/anime.md
@@ -42,6 +42,10 @@
+## 咚漫
+
+
+
## Anime1
diff --git a/lib/router.js b/lib/router.js
index 971a033f4d..e12b164f14 100755
--- a/lib/router.js
+++ b/lib/router.js
@@ -936,6 +936,8 @@ router.get('/manhuagui/comic/:id', require('./routes/manhuagui/comic'));
router.get('/cartoonmad/comic/:id', require('./routes/cartoonmad/comic'));
// Vol
router.get('/vol/:mode?', require('./routes/vol/lastupdate'));
+// 咚漫
+router.get('/dongmanmanhua/comic/:category/:name/:id', require('./routes/dongmanmanhua/comic'));
// Tits Guru
router.get('/tits-guru/home', require('./routes/titsguru/home'));
diff --git a/lib/routes/dongmanmanhua/comic.js b/lib/routes/dongmanmanhua/comic.js
new file mode 100644
index 0000000000..fab398c76d
--- /dev/null
+++ b/lib/routes/dongmanmanhua/comic.js
@@ -0,0 +1,45 @@
+const cheerio = require('cheerio');
+const axios = require('../../utils/axios');
+const domain = 'https://www.dongmanmanhua.cn';
+
+module.exports = async (ctx) => {
+ const category = ctx.params.category;
+ const name = ctx.params.name;
+ const id = ctx.params.id;
+
+ const comicLink = `${domain}/${category}/${name}/list?title_no=${id}`;
+ const { data } = await axios.get(comicLink);
+ const $ = cheerio.load(data);
+
+ const bookName = $('.detail_header .info .subj').text();
+ const title = $('#_listUl span.subj')
+ .map(function() {
+ return $(this).text();
+ })
+ .get();
+ const date = $('#_listUl span.date')
+ .map(function() {
+ return $(this)
+ .text()
+ .replace(/\n|\r|\t/g, '');
+ })
+ .get();
+ const link = $('#_listUl > li > a')
+ .map(function() {
+ return 'https:' + $(this).attr('href');
+ })
+ .get();
+ const resultItem = title.map((t, i) => ({
+ title: t,
+ pubDate: new Date(date[i]).toUTCString(),
+ link: link[i],
+ description: '',
+ }));
+
+ ctx.state.data = {
+ title: `咚漫 ${bookName}`,
+ link: comicLink,
+ description: `咚漫 ${bookName}`,
+ item: resultItem,
+ };
+};