mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-09 23:00:48 +08:00
24 lines
658 B
JavaScript
24 lines
658 B
JavaScript
const got = require('@/utils/got');
|
|
const { rootUrl, apiRootUrl, ProcessItems } = require('./utils');
|
|
|
|
module.exports = async (ctx) => {
|
|
const id = ctx.params.id ?? '1';
|
|
|
|
const currentUrl = `${rootUrl}/channel/${id}`;
|
|
const apiUrl = `${apiRootUrl}/v2/feed/category/${id}`;
|
|
|
|
const response = await got({
|
|
method: 'get',
|
|
url: apiUrl,
|
|
});
|
|
|
|
const items = await ProcessItems(response.data.items, ctx.query.limit, ctx.cache.tryGet);
|
|
|
|
ctx.state.data = {
|
|
title: `${response.data.category.publishName} | 香港01`,
|
|
link: currentUrl,
|
|
item: items,
|
|
image: response.data.category.icon,
|
|
};
|
|
};
|