diff --git a/docs/README.md b/docs/README.md index 3a84445bb..a25f27a5d 100644 --- a/docs/README.md +++ b/docs/README.md @@ -630,6 +630,24 @@ GitHub 官方也提供了一些 RSS: > 极客时间专栏需要付费订阅, RSS 仅做更新提醒, 不含付费内容. +### 安全客 + +::: tip 提示 + +官方提供了混合的主页资讯 RSS: https://api.anquanke.com/data/v1/rss + +::: + + + + + +| 360 网络安全周报 | 活动 |  知识  |  资讯  |  招聘  | +| ---------------- | -------- | --------- | -------- | -------- | +| week | activity | knowledge | news | job | + + + ### LinkedKeeper diff --git a/router.js b/router.js index b4f825d4f..56d6a9a0e 100644 --- a/router.js +++ b/router.js @@ -428,6 +428,10 @@ router.get('/linkedkeeper/:type/:id?', require('./routes/linkedkeeper/index')); // 开源中国 router.get('/oschina/news', require('./routes/oschina/news')); +// 安全客 +router.get('/aqk/vul', require('./routes/aqk/vul')); +router.get('/aqk/:category', require('./routes/aqk/category')); + // 腾讯大家 router.get('/dajia', require('./routes/tencent/dajia/index')); diff --git a/routes/aqk/category.js b/routes/aqk/category.js new file mode 100644 index 000000000..0d8d86077 --- /dev/null +++ b/routes/aqk/category.js @@ -0,0 +1,22 @@ +const axios = require('../../utils/axios'); + +module.exports = async (ctx) => { + const api = 'https://api.anquanke.com/data/v1/posts?size=10&page=1&category='; + const type = ctx.params.category; + const host = 'https://www.anquanke.com'; + const res = await axios.get(`${api}${type}`); + const dataArray = res.data.data; + + const items = dataArray.map((item) => ({ + title: item.title, + description: item.desc, + pubDate: item.date, + link: `${host}/${type === 'week' ? 'week' : 'post'}/id/${item.id}`, + })); + + ctx.state.data = { + title: `安全客-${dataArray[0].category_name}`, + link: 'https://www.anquanke.com', + item: items, + }; +}; diff --git a/routes/aqk/vul.js b/routes/aqk/vul.js new file mode 100644 index 000000000..d900867d6 --- /dev/null +++ b/routes/aqk/vul.js @@ -0,0 +1,39 @@ +const axios = require('../../utils/axios'); +const cheerio = require('cheerio'); + +module.exports = async (ctx) => { + const url = 'https://www.anquanke.com'; + + const response = await axios.get(`${url}/vul`); + const $ = cheerio.load(response.data); + const list = $('table>tbody>tr').get(); + + const items = list.map((i) => { + const item = $(i); + + const title = item.find('td:first-child a').text(); + const cve = item.find('td:nth-child(2)').text(); + const pla = item + .find('.vul-type-item') + .text() + .replace(/\s+/g, ''); + const date = item + .find('td:nth-last-child(2)') + .text() + .replace(/\s+/g, ''); + const href = item.find('a').attr('href'); + + return { + title: `${title}【${cve}】${pla !== '未知' ? pla : ''}`, + description: `编号:${cve} | 平台:${pla}`, + pubDate: date, + link: `${url}${href}`, + }; + }); + + ctx.state.data = { + title: '安全客-漏洞cve报告', + link: 'https://www.anquanke.com/vul', + item: items, + }; +};