add 安全文摘 (#8294)

Co-authored-by: testkaili <testkaili@tencent.com>
Co-authored-by: kaiili <kaii@openingsource.org>
This commit is contained in:
kaiili 2021-11-27 15:56:36 +08:00 committed by GitHub
parent 0edd6a7387
commit fc91df64d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 52 additions and 0 deletions

View File

@ -450,6 +450,12 @@ GitHub 官方也提供了一些 RSS:
</Route>
## 安全文摘
### 首页
<Route author="kaiili" example="/secnews" path="/secnews" />
## 饿了么开放平台
### 商家开放平台公告

27
lib/v2/secnews/index.js Normal file
View File

@ -0,0 +1,27 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const url = 'http://wiki.ioin.in/';
const response = await got.get(String(url));
const $ = cheerio.load(response.data);
const list = $('table>tbody>tr').get();
const items = list.map((i) => {
const item = $(i);
const title = item.find('td:nth-child(2) a').text();
const pla = item.find('.vul-type-item').text().replace(/\s+/g, '');
const date = new Date(item.find('td:first-child').text().replace(/\s+/g, '')).toUTCString();
const href = item.find('td:nth-child(2) a').attr('href');
return {
title: `${title} ${pla !== '未知' ? pla : ''}`,
pubDate: date,
link: `${url}${href}`,
};
});
ctx.state.data = {
title: 'sec-news',
link: 'http://wiki.ioin.in/',
item: items,
};
};

View File

@ -0,0 +1,3 @@
module.exports = {
'/index': ['kaiili'],
};

13
lib/v2/secnews/radar.js Normal file
View File

@ -0,0 +1,13 @@
module.exports = {
'furstar.jp': {
_name: 'Furstar',
'.': [
{
title: '安全文摘首頁',
docs: 'https://docs.rsshub.app/shopping.html#an-quan-wen-zhai',
source: ['/', '/'],
target: '/secnews/index',
},
],
},
};

3
lib/v2/secnews/router.js Normal file
View File

@ -0,0 +1,3 @@
module.exports = function (router) {
router.get('', require('./index'));
};