Files
RSSHub/lib/v2/sspai/shortcutsGallery.js
Henry Wang 1a547caf3b feat(route): 更新少数派全文支持 (#9653)
* feat: 少数派首页全文输出

* feat: 少数派全路由全文

* feat: 少数派专栏全文

* refactor: migrate to v2

* fix: cache key
2022-05-01 17:34:45 +08:00

30 lines
998 B
JavaScript

const got = require('@/utils/got');
const { parseDate } = require('@/utils/parse-date');
module.exports = async (ctx) => {
const {
data: { data: categories },
} = await got('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: parseDate(shortcut.utime * 1000),
guid: shortcut.id,
link: shortcut.url,
});
}
}
ctx.state.data = {
title: 'Shortcuts Gallery - 少数派',
link: 'https://shortcuts.sspai.com/#/main/workflow',
description: 'Shortcuts Gallery - 少数派',
item: items,
};
};