UNPKG

rsshub

Version:
44 lines (42 loc) 1.47 kB
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 { t as cache_default } from "./cache-Bo__VnGm.mjs"; import "./timezone-D8cuwzTY.mjs"; import { n as rootUrl, t as ProcessFeed } from "./utils-DCl5KBWU.mjs"; import { load } from "cheerio"; //#region lib/routes/p-articles/contributors.ts const route = { path: "/contributors/:author", categories: ["reading"], example: "/p-articles/contributors/黃衍仁", parameters: { author: "虛詞作者, 可在作者页面 URL 找到" }, name: "虛詞作者", maintainers: ["Insomnia1437"], handler, radar: [{ source: ["p-articles.com/contributors/:author"] }] }; async function handler(ctx) { const authorName = ctx.req.param("author"); const authorUrl = new URL(`/contributors/${authorName}`, rootUrl).href; const $ = load(await ofetch_default(authorUrl)); const list = $("div.contect_box_05in > a").toArray().map((element) => { return { title: $(element).find("h3").text().trim(), link: new URL($(element).attr("href"), rootUrl).href }; }); return { title: "虚词 p-articles", link: authorUrl, item: await Promise.all(list.map((info) => cache_default.tryGet(info.link, async () => { return ProcessFeed(info, await ofetch_default(info.link)); }))), language: "zh-cn" }; } //#endregion export { route };