feat: 增强 色花堂 路由 (#2174)

This commit is contained in:
junfengP 2019-05-19 17:24:34 +08:00 committed by DIYgod
parent f77d2dc0d6
commit 6c1e54205b
3 changed files with 37 additions and 6 deletions

View File

@ -204,9 +204,15 @@ pageClass: routes
## 色花堂中文论坛
### 帖子
### 原创 BT 电影
<Route author="qiwihui" example="/dsndsht23" path="/dsndsht23" supportBT="1" />
<Route author="qiwihui junfengP" example="/dsndsht23" path="/dsndsht23/:subforumid?" supportBT="1" :paramsDesc="['版块 id, 为空默认高清中文字幕']>
| 每日合集 | 国产原创 | 亚洲无码原创 | 亚洲有码原创 | 高清中文字幕 | 三级写真 | 亚洲名站有码 | VR 系列 | 欧美无码 | 动漫原创 | AI 换脸电影 | 原档收藏 WMV |
| -------- | -------- | ------------ | ------------ | ------------ | -------- | ------------ | ------- | -------- | -------- | ----------- | ------------ |
| mrhj | gcyc | yzwmyc | yzymyc | gqzwzm | sjxz | yzmzym | vr | omwm | dmyc | ai | ydsc |
</Route>
## 腾讯视频

View File

@ -1307,6 +1307,7 @@ router.get('/swufe/seie/:type?', require('./routes/universities/swufe/seie'));
router.get('/enclavebooks/category/:id?', require('./routes/enclavebooks/category'));
// 色花堂
router.get('/dsndsht23/:subforumid', require('./routes/dsndsht23/index'));
router.get('/dsndsht23', require('./routes/dsndsht23/index'));
// 数英网最新文章

View File

@ -3,8 +3,24 @@ const cheerio = require('cheerio');
const host = 'https://www.dsndsht23.com/';
const map = {
mrhj: 'forum-106-1.html',
gcyc: 'forum-2-1.html',
yzwmyc: 'forum-36-1.html',
yzymyc: 'forum-37-1.html',
gqzwzm: 'forum-103-1.html',
sjxz: 'forum-107-1.html',
yzmzym: 'forum-104-1.html',
vr: 'forum-102-1.html',
omwm: 'forum-38-1.html',
dmyc: 'forum-39-1.html',
ai: 'forum-113-1.html',
ydsc: 'forum-111-1.html',
};
module.exports = async (ctx) => {
const link = `https://www.dsndsht23.com/forum-103-1.html`;
const subforumid = ctx.params.subforumid || 'gqzwzm';
const link = `https://www.dsndsht23.com/${map[subforumid]}`;
const response = await axios.get(link);
const $ = cheerio.load(response.data);
@ -32,7 +48,7 @@ module.exports = async (ctx) => {
date: $(this)
.find('td.by')
.find('em span span')
.text(),
.attr('title'),
};
return info;
})
@ -52,7 +68,15 @@ module.exports = async (ctx) => {
const response = await axios.get(itemUrl);
const $ = cheerio.load(response.data);
const postMessage = $("td[id^='postmessage']");
const postMessage = $("td[id^='postmessage']").slice(0, 1);
const images = $(postMessage).find('img');
for (let k = 0; k < images.length; k++) {
if (!$(images[k]).attr('file') || $(images[k]).attr('file') === 'undefined') {
$(images[k]).replaceWith('');
} else {
$(images[k]).replaceWith(`<img src="${$(images[k]).attr('file')}" referrerpolicy="no-referrer" />`);
}
}
const description = postMessage.html();
const enclosureUrl = postMessage.find('div.blockcode li').text();
@ -70,7 +94,7 @@ module.exports = async (ctx) => {
);
ctx.state.data = {
title: `色花堂中文论坛`,
title: `色花堂 - ${$('#pt > div:nth-child(1) > a:last-child').text()}`,
link: link,
item: out,
};