diff --git a/docs/other.md b/docs/other.md index b0956f8c4..5bfdf13ba 100644 --- a/docs/other.md +++ b/docs/other.md @@ -517,6 +517,10 @@ type 为 all 时,category 参数不支持 cost 和 free +## 7x24 小时快讯 + + + ## gradCafe(一个比较流行的国外研究生录取结果通知) diff --git a/lib/router.js b/lib/router.js index 5fec58db4..2d7829fa8 100755 --- a/lib/router.js +++ b/lib/router.js @@ -1326,4 +1326,7 @@ router.get('/the-economist/gre-vocabulary', require('./routes/the-economist/gre- router.get('/asahichinese-f/:category/:subCate', require('./routes/asahichinese-f/index')); router.get('/asahichinese-f/:category', require('./routes/asahichinese-f/index')); +// 7x24小时快讯 +router.get('/fx678/kx', require('./routes/fx678/kx')); + module.exports = router; diff --git a/lib/routes/fx678/kx.js b/lib/routes/fx678/kx.js new file mode 100644 index 000000000..d6d85911a --- /dev/null +++ b/lib/routes/fx678/kx.js @@ -0,0 +1,34 @@ +const cheerio = require('cheerio'); +const axios = require('../../utils/axios'); + +module.exports = async (ctx) => { + const url = 'https://kx.fx678.com/'; + const res = await axios.get(url); + const $ = cheerio.load(res.data); + + const list = $('.body_zb ul .body_zb_li'); + // 爬取页面的前30条消息 + const content = list + .slice(0, 30) + .map(function() { + const title = $(this) + .find('.zb_time') + .text(); + const description = $(this) + .find('.zb_word') + .text() + .replace(/(^\s*)|(\s*$)/g, ''); + const item = { + title, + description, + }; + return item; + }) + .get(); + + ctx.state.data = { + title: '7x24小时快讯', + link: url, + item: content, + }; +};