增加 终点分享 最新汉化 的RSS (#1828)
源站bbs.zdfx.net汉化板块需要登陆,且该板块屏蔽论坛自身RSS功能。 抓取思路:首页会显示7篇最新汉化文章。附测试结果。 
This commit is contained in:
parent
42d9db87a8
commit
da7f35616e
|
|
@ -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']"/>
|
||||
|
|
|
|||
|
|
@ -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'));
|
||||
|
|
|
|||
|
|
@ -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(),
|
||||
};
|
||||
};
|
||||
Loading…
Reference in New Issue