Files
RSSHub/lib/v2/cyzone/label.js
T
Ethan Shen 4b105834fb feat(route): 创业邦资讯 (#13083)
* feat(route): 创业邦资讯

* fix: remove async

* fix docs

* fix typo

* fix typo

* apply suggestions from code review

* update lib/v2/cyzone/index.js

---------
2023-08-29 09:21:41 +08:00

21 lines
589 B
JavaScript

const { rootUrl, apiRootUrl, processItems, getInfo } = require('./util');
module.exports = async (ctx) => {
const { name } = ctx.params;
const limit = ctx.query.limit ? parseInt(ctx.query.limit, 10) : 5;
const apiUrl = new URL('v2/content/tag/tagList', apiRootUrl).href;
const currentUrl = new URL(`label/${name}`, rootUrl).href;
const items = await processItems(apiUrl, limit, ctx.cache.tryGet, {
tag: name,
});
ctx.state.data = {
...{
item: items,
},
...(await getInfo(currentUrl, ctx.cache.tryGet)),
};
};