* fix: #10799

* refactor: migrate to v2
This commit is contained in:
水货 2022-09-16 19:20:54 +08:00 committed by GitHub
parent 02c724553f
commit 383ee72a6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 79 additions and 28 deletions

View File

@ -712,17 +712,13 @@ GitHub 官方也提供了一些 RSS:
:::
### 最新漏洞列表
<Route author="qwertyuiop6" example="/aqk/vul" path="/aqk/vul"/>
### 分类订阅
<Route author="qwertyuiop6" example="/aqk/week" path="/aqk/:category" :paramsDesc="['分类订阅']">
<Route author="qwertyuiop6" example="/anquanke/week" path="/anquanke/:category" :paramsDesc="['分类订阅']" radar="1" rssbud="1">
| 360 网络安全周报 | 活动 | 知识 | 资讯 | 招聘 |
| ---------- | -------- | --------- | ---- | --- |
| week | activity | knowledge | news | job |
| 360 网络安全周报 | 活动 | 知识 | 资讯 | 招聘 | 工具 |
| ---------- | -------- | --------- | ---- | --- | ---- |
| week | activity | knowledge | news | job | tool |
</Route>
@ -730,11 +726,11 @@ GitHub 官方也提供了一些 RSS:
### 分类
<Route author="XinRoom" example="/secrss/category/产业趋势" path="/secrss/category/:category"/>
<Route author="XinRoom" example="/secrss/category/产业趋势" path="/secrss/category/:category?" radar="1" rssbud="1"/>
### 作者
<Route author="XinRoom" example="/secrss/author/网络安全威胁和漏洞信息共享平台" path="/secrss/author/:author"/>
<Route author="XinRoom" example="/secrss/author/网络安全威胁和漏洞信息共享平台" path="/secrss/author/:author" radar="1" rssbud="1"/>
## 安全文摘

View File

@ -407,8 +407,8 @@ router.get('/technologyreview', lazyloadRouteHandler('./routes/technologyreview/
router.get('/technologyreview/:category_name', lazyloadRouteHandler('./routes/technologyreview/topic'));
// 安全客
router.get('/aqk/vul', lazyloadRouteHandler('./routes/aqk/vul'));
router.get('/aqk/:category', lazyloadRouteHandler('./routes/aqk/category'));
// router.get('/aqk/vul', lazyloadRouteHandler('./routes/aqk/vul'));
// router.get('/aqk/:category', lazyloadRouteHandler('./routes/aqk/category'));
// 腾讯游戏开发者社区
router.get('/gameinstitute/community/:tag?', lazyloadRouteHandler('./routes/tencent/gameinstitute/community'));
@ -4056,8 +4056,8 @@ router.get('/fashionnetwork/news/:sectors?/:categories?/:language?', lazyloadRou
router.get('/dykszx/news/:type?', lazyloadRouteHandler('./routes/dykszx/news'));
// 安全内参
router.get('/secrss/category/:category?', lazyloadRouteHandler('./routes/secrss/category'));
router.get('/secrss/author/:author?', lazyloadRouteHandler('./routes/secrss/author'));
// router.get('/secrss/category/:category?', lazyloadRouteHandler('./routes/secrss/category'));
// router.get('/secrss/author/:author?', lazyloadRouteHandler('./routes/secrss/author'));
// Fashion Network
router.get('/fashionnetwork/headline/:country?', lazyloadRouteHandler('./routes/fashionnetwork/headline.js'));

View File

@ -1,22 +1,25 @@
const got = require('@/utils/got');
const { parseDate } = require('@/utils/parse-date');
const timezone = require('@/utils/timezone');
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 got.get(`${api}${type}`);
const res = await got(`${api}${type}`);
const dataArray = res.data.data;
const items = dataArray.map((item) => ({
title: item.title,
description: item.desc,
pubDate: item.date,
pubDate: timezone(parseDate(item.date), +8),
link: `${host}/${type === 'week' ? 'week' : 'post'}/id/${item.id}`,
author: item.author.nickname,
}));
ctx.state.data = {
title: `安全客-${dataArray[0].category_name}`,
link: 'https://www.anquanke.com',
link: `https://www.anquanke.com/${type === 'week' ? 'week-list' : type}`,
item: items,
};
};

View File

@ -0,0 +1,4 @@
module.exports = {
// '/vul': ['qwertyuiop6'],
'/:category': ['qwertyuiop6'],
};

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

@ -0,0 +1,13 @@
module.exports = {
'anquanke.com': {
_name: '安全客',
'.': [
{
title: '分类订阅',
docs: 'https://docs.rsshub.app/programming.html#an-quan-ke',
source: ['/:category', '/'],
target: (params) => `/anquanke/${params.category === 'week-list' ? 'week' : params.category}`,
},
],
},
};

View File

@ -0,0 +1,4 @@
module.exports = (router) => {
// router.get('/vul', require('./vul')); // 404
router.get('/:category', require('./category'));
};

View File

@ -1,10 +1,11 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const { parseDate } = require('@/utils/parse-date');
module.exports = async (ctx) => {
const url = 'https://www.anquanke.com';
const response = await got.get(`${url}/vul`);
const response = await got(`${url}/vul`);
const $ = cheerio.load(response.data);
const list = $('table>tbody>tr').get();
@ -14,7 +15,7 @@ module.exports = async (ctx) => {
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 = new Date(item.find('td:nth-last-child(2)').text().replace(/\s+/g, '')).toUTCString();
const date = parseDate(item.find('td:nth-last-child(2)').text().replace(/\s+/g, ''));
const href = item.find('a').attr('href');
return {

View File

@ -1,17 +1,19 @@
const got = require('@/utils/got');
const { parseDate } = require('@/utils/parse-date');
module.exports = async (ctx) => {
const api = 'https://www.secrss.com/api/articles/group?author=';
const author = ctx.params.author;
const host = 'https://www.secrss.com';
const res = await got.get(`${api}${author}`);
const res = await got(`${api}${author}`);
const dataArray = res.data.data.list;
const items = dataArray.map((item) => ({
title: item.title,
description: item.summary,
pubDate: new Date(item.original_timestamp * 1000).toUTCString(),
pubDate: parseDate(item.original_timestamp, 'X'),
link: `${host}${item.url}`,
category: item.tag,
}));
ctx.state.data = {

View File

@ -1,24 +1,25 @@
const got = require('@/utils/got');
const { parseDate } = require('@/utils/parse-date');
const timezone = require('@/utils/timezone');
module.exports = async (ctx) => {
const api = 'https://www.secrss.com/api/articles?tag=';
let type = ctx.params.category;
if (type === undefined) {
type = '';
}
const { category = '' } = ctx.params;
const host = 'https://www.secrss.com';
const res = await got.get(`${api}${type}`);
const res = await got(`${api}${category}`);
const dataArray = res.data.data;
const items = dataArray.map((item) => ({
title: item.title,
description: item.summary,
pubDate: new Date(item.published_at + ' GMT').toUTCString(),
pubDate: timezone(parseDate(item.published_at), +8),
link: `${host}/articles/${item.id}`,
author: item.source_author,
category: item.tags.map((t) => t.title),
}));
ctx.state.data = {
title: `安全内参-${type}`,
title: `安全内参-${category}`,
link: 'https://www.secrss.com',
item: items,
};

View File

@ -0,0 +1,4 @@
module.exports = {
'/author/:author': ['XinRoom'],
'/category/:category?': ['XinRoom'],
};

19
lib/v2/secrss/radar.js Normal file
View File

@ -0,0 +1,19 @@
module.exports = {
'secrss.com': {
_name: '安全内参',
'.': [
{
title: '分类',
docs: 'https://docs.rsshub.app/programming.html#an-quan-nei-can',
source: ['/articles', '/'],
target: (_, url) => `/secrss/category${new URL(url).searchParams.has('tag') ? `/${new URL(url).searchParams.get('tag')}` : ''}`,
},
{
title: '作者',
docs: 'https://docs.rsshub.app/programming.html#an-quan-nei-can',
source: ['/articles', '/'],
target: (_, url) => `/secrss/author${new URL(url).searchParams.get('author')}`,
},
],
},
};

4
lib/v2/secrss/router.js Normal file
View File

@ -0,0 +1,4 @@
module.exports = (router) => {
router.get('/author/:author', require('./author'));
router.get('/category/:category?', require('./category'));
};