forked from DIYgod/RSSHub
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(route): add slowmist news (DIYgod#10044)
* feat(route): add slowmist news * feat(utils): remove useless ul for code section * docs: add slowmist news route docs * docs(quick-start): new router under /lib/v2 * test(utils): add test fixArticleContent for new wechat-mp code * feat(router): update radar source of slowmist
- Loading branch information
Showing
7 changed files
with
101 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module.exports = { | ||
'slowmist.com': { | ||
_name: '慢雾科技 SLOWMIST', | ||
'.': [ | ||
{ | ||
title: '动态', | ||
docs: 'https://docs.rsshub.app/new-media.html#man-wu-ke-ji', | ||
source: ['/zh/news.html'], | ||
target: '/slowmist/:type?', | ||
}, | ||
], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = function (router) { | ||
router.get('/:type?', require('./slowmist')); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
const got = require('@/utils/got'); | ||
const { parseDate } = require('@/utils/parse-date'); | ||
const baseUrl = 'https://www.slowmist.com'; | ||
const { finishArticleItem } = require('@/utils/wechat-mp'); | ||
|
||
module.exports = async (ctx) => { | ||
let type = ctx.params.type; | ||
|
||
let title = '慢雾科技 - '; | ||
if (type === 'news') { | ||
title += '公司新闻'; | ||
} else if (type === 'vul') { | ||
title += '漏洞披露'; | ||
} else if (type === 'research') { | ||
title += '技术研究'; | ||
} else { | ||
type = 'news'; | ||
title += '公司新闻'; | ||
} | ||
|
||
const url = `${baseUrl}/api/get_list?type=${type}`; | ||
|
||
const response = await got(url); | ||
|
||
let items = (response.data.data || []).map((item) => ({ | ||
title: item.title, | ||
link: item.url, | ||
description: item.desc, | ||
pubDate: parseDate(item.date), | ||
})); | ||
|
||
items = await Promise.all(items.map((item) => finishArticleItem(ctx, item))); | ||
|
||
ctx.state.data = { | ||
title, | ||
link: url, | ||
item: items, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters