diff --git a/docs/social-media.md b/docs/social-media.md
index 88a6a8d26a..5b67796795 100644
--- a/docs/social-media.md
+++ b/docs/social-media.md
@@ -564,7 +564,13 @@ Tiny Tiny RSS 会给所有 iframe 元素添加 `sandbox="allow-scripts"` 属性
### 热门瞬间
-
+
+
+::: tip 提示
+
+提供不同内容的 `pid`, 可以得到不同的热门瞬间推荐,如果想看多个种类的热门可以用 `/` 把不同的 `pid` 连起来,例如: `NXJiSlM5V21kamJWVlgvZUh1NEExdz09/MkM0amxSTUNiTEpLcHhzSlRzTEI1dz09`
+
+:::
## Tape 小纸条
diff --git a/lib/router.js b/lib/router.js
index 211d20bc3b..66a305c9ec 100644
--- a/lib/router.js
+++ b/lib/router.js
@@ -2107,7 +2107,7 @@ router.get('/hanime/video', require('./routes/hanime/video'));
// Soul
router.get('/soul/:id', require('./routes/soul'));
-router.get('/soul/posts/hot', require('./routes/soul/hot'));
+router.get('/soul/posts/hot/:pid*', require('./routes/soul/hot'));
// 单向空间
router.get('/owspace/read/:type?', require('./routes/owspace/read'));
diff --git a/lib/routes/soul/hot.js b/lib/routes/soul/hot.js
index 8864f04233..b477b276fe 100644
--- a/lib/routes/soul/hot.js
+++ b/lib/routes/soul/hot.js
@@ -1,26 +1,33 @@
const got = require('@/utils/got');
+const { parseDate } = require('@/utils/parse-date');
const generateResponse = async (items) => ({
// 源标题
- title: '热门瞬间',
+ title: 'Soul 热门瞬间',
// 源链接
- link: 'https://api-h5.soulapp.cn/html/v2/post/hot?pageIndex=2',
+ link: 'https://api-h5.soulapp.cn/html/v2/post/hot?postIdEcpt',
item: items.map((item) => ({
title: `「${item.uName}」的瞬间:${item.pureContent}`,
author: item.uName,
description: item.content,
- pubDate: new Date(item.createTime).toUTCString(),
+ pubDate: parseDate(item.createTime),
guid: item.pId,
link: `https://w3.soulsmile.cn/activity/#/web/topic/detail?postIdEcpt=${item.pId}`,
})),
});
+
module.exports = async (ctx) => {
+ // 根据不同用户瞬间会得到不同的结果,这里提供一些例子
+ const defaultPid = 'NXJiSlM5V21kamJWVlgvZUh1NEExdz09';
+ const userPid = ctx.params.pid || defaultPid;
+ const examplePids = userPid.split('/');
+
const rsps = await Promise.all(
- [1, 2].map((pageId) =>
+ examplePids.map((pId) =>
got({
method: 'get',
- url: `https://api-h5.soulapp.cn/html/v2/post/hot?pageIndex=${pageId}`,
+ url: `https://api-h5.soulapp.cn/html/v2/post/hot?postIdEcpt=${pId}`,
})
)
);
@@ -62,5 +69,7 @@ module.exports = async (ctx) => {
allItems.push(...items);
});
- ctx.state.data = await generateResponse(allItems);
+ const uniqAllItems = allItems.filter((value, idx, arr) => arr.findIndex((item) => (item.pId === value.pId)) === idx);
+
+ ctx.state.data = await generateResponse(uniqAllItems);
};