From da7f35616e11dc95b1d509cac65b25e8a9742985 Mon Sep 17 00:00:00 2001 From: junfengP <840282629@qq.com> Date: Tue, 26 Mar 2019 10:51:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20=E7=BB=88=E7=82=B9?= =?UTF-8?q?=E5=88=86=E4=BA=AB=20=E6=9C=80=E6=96=B0=E6=B1=89=E5=8C=96=20?= =?UTF-8?q?=E7=9A=84RSS=20(#1828)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 源站bbs.zdfx.net汉化板块需要登陆,且该板块屏蔽论坛自身RSS功能。 抓取思路:首页会显示7篇最新汉化文章。附测试结果。 ![image](https://user-images.githubusercontent.com/15406392/54900785-85d5dd00-4f0f-11e9-9a31-945ffd34a0b8.png) --- docs/anime.md | 4 ++++ lib/router.js | 3 +++ lib/routes/galgame/zdfx.js | 30 ++++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+) create mode 100644 lib/routes/galgame/zdfx.js diff --git a/docs/anime.md b/docs/anime.md index 6781261a1..4deca406c 100644 --- a/docs/anime.md +++ b/docs/anime.md @@ -26,6 +26,10 @@ +## 终点分享 + + + ## 看漫画 diff --git a/lib/router.js b/lib/router.js index 1f9ddba63..8855142d3 100755 --- a/lib/router.js +++ b/lib/router.js @@ -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')); diff --git a/lib/routes/galgame/zdfx.js b/lib/routes/galgame/zdfx.js new file mode 100644 index 000000000..d1989c400 --- /dev/null +++ b/lib/routes/galgame/zdfx.js @@ -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(), + }; +};