rsshub
Version:
Make RSS Great Again!
66 lines (63 loc) • 2.05 kB
JavaScript
import "./esm-shims-CzJ_djXG.mjs";
import "./config-C37vj7VH.mjs";
import { t as ViewType } from "./types-D84BRIt4.mjs";
import "./dist-BInvbO1W.mjs";
import "./logger-Czu8UMNd.mjs";
import { t as ofetch_default } from "./ofetch-BIyrKU3Y.mjs";
import "./parse-date-BrP7mxXf.mjs";
import { i as rootUrl, n as language, r as processItems, t as author } from "./util-CGGCO7j-.mjs";
//#region lib/routes/ifun/n/tag.ts
const handler = async (ctx) => {
const { name } = ctx.req.param();
const limit = Number.parseInt(ctx.req.query("limit") ?? "30", 10);
const targetUrl = new URL(`article-list/1?tagName=${name}`, rootUrl).href;
const apiUrl = new URL("api/articles/tagId", rootUrl).href;
const items = processItems((await ofetch_default(apiUrl, { query: {
datasrc: "tagid",
tagname: name,
current: 1,
size: limit
} })).data.records, limit);
return {
title: `${author} - ${name}`,
description: name,
link: targetUrl,
item: items,
allowEmpty: true,
author,
language
};
};
const route = {
path: "/n/tag/:name",
name: "盐选故事专栏",
url: "n.ifun.cool",
maintainers: ["nczitzk"],
handler,
example: "/ifun/n/tag/zhihu",
parameters: { name: "专栏 id,可在对应专栏页 URL 中找到" },
description: `::: tip
若订阅 [zhihu](https://n.ifun.cool/article-list/2?tagName=zhihu),网址为 \`https://n.ifun.cool/article-list/2?tagName=zhihu\`,请截取 \`tagName\` 的值 \`zhihu\` 作为 \`name\` 参数填入,此时目标路由为 [\`/ifun/n/tag/zhihu\`](https://rsshub.app/ifun/n/tag/zhihu)。
更多专栏请见 [盐选故事专栏](https://n.ifun.cool/tags)。
:::
`,
categories: ["new-media"],
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportRadar: true,
supportBT: false,
supportPodcast: false,
supportScihub: false
},
radar: [{
source: ["n.ifun.cool/article-list/1"],
target: (_, url) => {
return `/ifun/n/tag/${new URL(url).searchParams.get("tagName")}`;
}
}],
view: ViewType.Articles
};
//#endregion
export { handler, route };