Files
RSSHub/lib/v2/cyzone/author.js
T
2024-02-28 16:25:59 +08:00

19 lines
584 B
JavaScript

const { rootUrl, apiRootUrl, processItems, getInfo } = require('./util');
module.exports = async (ctx) => {
const { id } = ctx.params;
const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : 5;
const apiUrl = new URL('v2/author/author/detail', apiRootUrl).href;
const currentUrl = new URL(`author/${id}`, rootUrl).href;
const items = await processItems(apiUrl, limit, ctx.cache.tryGet, {
author_id: id,
});
ctx.set('data', {
item: items,
...(await getInfo(currentUrl, ctx.cache.tryGet)),
});
};