diff --git a/docs/README.md b/docs/README.md index 7adaef73c6..fb9b52d41d 100644 --- a/docs/README.md +++ b/docs/README.md @@ -2819,3 +2819,7 @@ board 和 build 可在[这里](http://api.ineal.me/tss/status)查看 ### 创业邦 + +### 政府 + + diff --git a/lib/router.js b/lib/router.js index 4c2229e70d..6bc43d4f15 100644 --- a/lib/router.js +++ b/lib/router.js @@ -1001,6 +1001,9 @@ router.get('/duozhuayu/search/:wd', require('./routes/duozhuayu/search')); // 创业邦 router.get('/cyzone/author/:id', require('./routes/cyzone/author')); +// 政府 +router.get('/gov/zhengce/zuixin', require('./routes/gov/zhengce/zuixin')); + // 小黑盒 router.get('/xiaoheihe/user/:id', require('./routes/xiaoheihe/user')); diff --git a/lib/routes/gov/zhengce/zuixin.js b/lib/routes/gov/zhengce/zuixin.js new file mode 100644 index 0000000000..6218a1a6ec --- /dev/null +++ b/lib/routes/gov/zhengce/zuixin.js @@ -0,0 +1,24 @@ +const axios = require('../../../utils/axios'); +const cheerio = require('cheerio'); + +module.exports = async (ctx) => { + const link = `http://www.gov.cn/zhengce/zuixin.htm`; + const response = await axios.get(link); + const $ = cheerio.load(response.data); + ctx.state.data = { + title: `最新政策 - 中国政府网`, + link, + item: $('.news_box .list li:not(.line)') + .map((i, el) => { + const $el = $(el); + const $a = $el.find('h4 a'); + return { + title: $a.text(), + description: $a.text(), + link: $a.attr('href'), + pubDate: new Date($el.find('.date').text()).toUTCString(), + }; + }) + .get(), + }; +};