mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-16 02:42:57 +08:00
新增少数派 Shortcuts Gallery (#772)
https://github.com/DIYgod/RSSHub/issues/771
This commit is contained in:
@@ -1641,6 +1641,8 @@ IATA 国际航空运输协会机场代码, 参见[维基百科 国际航空运
|
||||
|
||||
</route>
|
||||
|
||||
<route name="Shortcuts Gallery" author="Andiedie" example="/sspai/shortcuts" path="/sspai/shortcuts" />
|
||||
|
||||
### 电影首发站
|
||||
|
||||
<route name="电影首发站" author="epirus" example="/dysfz/index" path="/dysfz/index">
|
||||
|
||||
@@ -560,6 +560,7 @@ router.get('/douyin/user/:id', require('./routes/douyin/user'));
|
||||
|
||||
// 少数派 sspai
|
||||
router.get('/sspai/series', require('./routes/sspai/series'));
|
||||
router.get('/sspai/shortcuts', require('./routes/sspai/shortcutsGallery'));
|
||||
|
||||
// xclient.info
|
||||
router.get('/xclient/app/:name', require('./routes/xclient/app'));
|
||||
|
||||
28
routes/sspai/shortcutsGallery.js
Normal file
28
routes/sspai/shortcutsGallery.js
Normal file
@@ -0,0 +1,28 @@
|
||||
const axios = require('../../utils/axios');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const {
|
||||
data: { data: categories },
|
||||
} = await axios.get('https://shortcuts.sspai.com/api/v1/user/workflow/all/get');
|
||||
|
||||
const items = [];
|
||||
|
||||
for (const category of categories) {
|
||||
for (const shortcut of category.data || []) {
|
||||
items.push({
|
||||
title: shortcut.name,
|
||||
description: `作者:<a href="${shortcut.author_url || '#'}">${shortcut.author_id}</a><br/>${decodeURIComponent((shortcut.description || '').replace(/\+/g, '%20'))}`,
|
||||
pubDate: new Date(shortcut.utime * 1000).toUTCString(),
|
||||
guid: shortcut.id,
|
||||
link: shortcut.url,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
ctx.state.data = {
|
||||
title: 'Shortcuts Gallery - 少数派',
|
||||
link: 'https://shortcuts.sspai.com/#/main/workflow',
|
||||
description: 'Shortcuts Gallery - 少数派',
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user