diff --git a/docs/README.md b/docs/README.md index 51423a97f4..16c5e38dfd 100644 --- a/docs/README.md +++ b/docs/README.md @@ -2824,6 +2824,10 @@ board 和 build 可在[这里](http://api.ineal.me/tss/status)查看 +### 惠誉评级 + + + ### 移动支付网 diff --git a/lib/router.js b/lib/router.js index f0b64c60c5..ebc923bf38 100644 --- a/lib/router.js +++ b/lib/router.js @@ -1006,6 +1006,10 @@ router.get('/gov/zhengce/zuixin', require('./routes/gov/zhengce/zuixin')); // 小黑盒 router.get('/xiaoheihe/user/:id', require('./routes/xiaoheihe/user')); +// 惠誉评级 +router.get('/fitchratings/site/:type', require('./routes/fitchratings/site')); + // 移动支付 router.get('/mpaypass/news', require('./routes/mpaypass/news')); + module.exports = router; diff --git a/lib/routes/fitchratings/site.js b/lib/routes/fitchratings/site.js new file mode 100644 index 0000000000..abeebdba56 --- /dev/null +++ b/lib/routes/fitchratings/site.js @@ -0,0 +1,33 @@ +const axios = require('../../utils/axios'); +const cheerio = require('cheerio'); + +module.exports = async (ctx) => { + const type = ctx.params.type; + + const link = `https://www.fitchratings.com/site/${type}`; + const listData = await axios.get(link); + const $list = cheerio.load(listData.data); + ctx.state.data = { + title: `${type} - 惠誉评级`, + link, + item: await Promise.all( + $list('div.card-text-container') + .slice(0, 10) + .map(async (_, el) => { + const $el = $list(el); + const $a = $el.find('h4 a'); + + const href = $a.attr('href'); + const title = $a.text(); + const description = $el.find('div p').text(); + + return { + title: title, + description, + link: href, + }; + }) + .get() + ), + }; +};