rsshub
Version:
Make RSS Great Again!
52 lines (50 loc) • 1.41 kB
JavaScript
import "./esm-shims-CzJ_djXG.mjs";
import "./config-C37vj7VH.mjs";
import "./dist-BInvbO1W.mjs";
import "./logger-Czu8UMNd.mjs";
import { t as ofetch_default } from "./ofetch-BIyrKU3Y.mjs";
import "./parse-date-BrP7mxXf.mjs";
import "./cache-Bo__VnGm.mjs";
import { i as getTag, o as parseList, t as ProcessFeed } from "./utils-Do7XKeOT.mjs";
//#region lib/routes/juejin/tag.ts
const route = {
path: "/tag/:tag",
categories: ["programming"],
example: "/juejin/tag/JavaScript",
parameters: { tag: "标签名,可在标签 URL 中找到" },
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false
},
radar: [{ source: ["juejin.cn/tag/:tag"] }],
name: "标签",
maintainers: ["isheng5"],
handler
};
async function handler(ctx) {
const tag = ctx.req.param("tag");
const idResponse = await getTag(tag);
const id = idResponse.tag_id;
const resultItems = await ProcessFeed(parseList((await ofetch_default("https://api.juejin.cn/recommend_api/v1/article/recommend_tag_feed", {
method: "POST",
body: {
id_type: 2,
cursor: "0",
tag_ids: [id],
sort_type: 300
}
})).data));
return {
title: `掘金 ${tag}`,
link: `https://juejin.cn/tag/${encodeURIComponent(tag)}`,
description: `掘金 ${tag}`,
image: idResponse.tag.icon,
item: resultItems
};
}
//#endregion
export { route };