增加 终点分享 最新汉化 的RSS (#1828)

源站bbs.zdfx.net汉化板块需要登陆,且该板块屏蔽论坛自身RSS功能。
抓取思路:首页会显示7篇最新汉化文章。附测试结果。

![image](https://user-images.githubusercontent.com/15406392/54900785-85d5dd00-4f0f-11e9-9a31-945ffd34a0b8.png)
This commit is contained in:
junfengP 2019-03-26 10:51:32 +08:00 committed by DIYgod
parent 42d9db87a8
commit da7f35616e
3 changed files with 37 additions and 0 deletions

View File

@ -26,6 +26,10 @@
<Route name="文章" author="DIYgod" example="/mmgal" path="/mmgal"/>
## 终点分享
<Route name="最新汉化" author="junfengP" example="/zdfx" path="/zdfx"/>
## 看漫画
<Route name="漫画更新" author="MegrezZhu" path="/manhuagui/comic/:id" example="/manhuagui/comic/22942" :paramsDesc="['漫画ID']"/>

View File

@ -572,6 +572,9 @@ router.get('/gitlab/explore/:type', require('./routes/gitlab/explore'));
router.get('/mygalgame', require('./routes/galgame/mmgal'));
router.get('/mmgal', require('./routes/galgame/mmgal'));
// 终点分享
router.get('/zdfx', require('./routes/galgame/zdfx'));
// 大连工业大学
router.get('/dpu/jiaowu/news/:type?', require('./routes/universities/dpu/jiaowu/news'));
router.get('/dpu/wlfw/news/:type?', require('./routes/universities/dpu/wlfw/news'));

View File

@ -0,0 +1,30 @@
const axios = require('../../utils/axios');
const cheerio = require('cheerio');
const host = 'https://bbs.zdfx.net/';
module.exports = async (ctx) => {
const response = await axios({
method: 'get',
url: host,
});
const $ = cheerio.load(response.data);
const list = $('.slideother a');
const process = list.map((index, item) => {
const a = $(item);
const img_tag = '.slideshow a:nth-child(' + (index + 1).toString() + ')';
return {
title: a.text(),
description: $(img_tag).html(),
link: host + a.attr('href'),
};
});
ctx.state.data = {
title: '终点分享',
link: host,
description: '终点分享最新汉化通知',
item: process.get(),
};
};