From bd80574f76dc498aef06910fe186966ebf41eac6 Mon Sep 17 00:00:00 2001
From: Atlas Quan ' +
+ '
').insertAfter(code);
+ });
+
+ // clear line index tags in code section
+ $('.code-snippet__line-index').remove();
+
// fix single picture article
// example: https://mp.weixin.qq.com/s/4p5YmYuASiQSYFiy7KqydQ
$('script').each((_, script) => {
@@ -186,7 +194,6 @@ const fetchArticle = async (ctx, url, bypassHostCheck = false) => {
let summary = $('meta[name=description]').attr('content');
summary = summary !== title ? summary : '';
let description = fixArticleContent($('#js_content'));
-
// No article get or article is too short, try the original url
const originalUrl = detectOriginalArticleUrl($);
if (originalUrl) {
@@ -211,7 +218,6 @@ const fetchArticle = async (ctx, url, bypassHostCheck = false) => {
let mpName = $('.profile_nickname').first().text();
mpName = mpName && mpName.trim();
-
return { title, author, description, summary, pubDate, mpName, link: url };
});
};
diff --git a/lib/v2/slowmist/radar.js b/lib/v2/slowmist/radar.js
new file mode 100644
index 000000000..2bdf100e2
--- /dev/null
+++ b/lib/v2/slowmist/radar.js
@@ -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?',
+ },
+ ],
+ },
+};
diff --git a/lib/v2/slowmist/router.js b/lib/v2/slowmist/router.js
new file mode 100644
index 000000000..7439f0373
--- /dev/null
+++ b/lib/v2/slowmist/router.js
@@ -0,0 +1,3 @@
+module.exports = function (router) {
+ router.get('/:type?', require('./slowmist'));
+};
diff --git a/lib/v2/slowmist/slowmist.js b/lib/v2/slowmist/slowmist.js
new file mode 100644
index 000000000..7c2e99220
--- /dev/null
+++ b/lib/v2/slowmist/slowmist.js
@@ -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,
+ };
+};
diff --git a/test/utils/wechat-mp.js b/test/utils/wechat-mp.js
index 2be41f35e..d0719bf60 100644
--- a/test/utils/wechat-mp.js
+++ b/test/utils/wechat-mp.js
@@ -24,8 +24,28 @@ describe('wechat-mp', () => {
it('fixArticleContent', () => {
const divHeader = '' +
+ '' +
+ '
' +
+ '' +
+ '
Line1 {' +
+ 'Line2' +
+ 'Line3 }' +
+ '' +
+ '
Line1 {' +
+ '
' +
+ 'Line2' +
+ '
' +
+ 'Line3 }' +
+ '
' +
+ '
test
test
' + 'test
test
' + 'test
test
test
test
' + 'test
test
' + 'test
test
test
test
' + 'test