mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-01 01:28:08 +08:00
* * feat: add panda feed * * feat: document table inside the Route tag * * feat: panda route Introduce limit parameter * docs(ROUTE): add /panda/feeds/:id parameter description * refactor(ROUTE): Use a more appropriate path /usepanda/feeds/:id instead of /panda/feeds/:id * refactor(ROUTE): Remove non-existent attributes tags * feat(ROUTE): fix limit param * fix: add missing radar
27 lines
799 B
JavaScript
27 lines
799 B
JavaScript
const got = require('@/utils/got');
|
|
const { parseDate } = require('@/utils/parse-date');
|
|
|
|
module.exports = async (ctx) => {
|
|
const feedId = ctx.params.id;
|
|
const limit = ctx.query.limit ?? 30; // 默认30条
|
|
|
|
const rootUrl = 'https://api-panda.com/v4/';
|
|
const apiUrl = `${rootUrl}articles?feeds=${feedId}&limit=${limit}&page=1&sort=popular`;
|
|
|
|
const { data } = await got(apiUrl);
|
|
|
|
const items = data.map((item) => ({
|
|
title: `${item.title} 🌟 ${item.source.likesCount}`,
|
|
author: item.source.username,
|
|
pubDate: parseDate(item.source.createdAt),
|
|
link: item.source.targetUrl,
|
|
description: item.description,
|
|
}));
|
|
|
|
ctx.state.data = {
|
|
title: 'Panda Feeds',
|
|
link: 'https://usepanda.com/',
|
|
item: items,
|
|
};
|
|
};
|