UNPKG

rsshub

Version:
65 lines (63 loc) 1.95 kB
import "./esm-shims-CzJ_djXG.mjs"; import "./config-C37vj7VH.mjs"; import "./dist-BInvbO1W.mjs"; import "./logger-Czu8UMNd.mjs"; import "./ofetch-BIyrKU3Y.mjs"; import { t as parseDate } from "./parse-date-BrP7mxXf.mjs"; import { t as cache_default } from "./cache-Bo__VnGm.mjs"; import "./helpers-DxBp0Pty.mjs"; import { t as got_default } from "./got-KxxWdaxq.mjs"; import { n as parseArticle, t as baseUrl } from "./utils-Blx5-Wjc.mjs"; //#region lib/routes/woshipm/popular.ts const rangeMap = { daily: "日榜", weekly: "周榜", monthly: "月榜" }; const route = { path: "/popular/:range?", categories: ["new-media"], example: "/woshipm/popular", parameters: { range: "时间,见下表,默认为 `daily`" }, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false }, radar: [{ source: ["woshipm.com/"], target: "/popular" }], name: "热门文章", maintainers: ["WenryXu"], handler, url: "woshipm.com/", description: `| 日榜 | 周榜 | 月榜 | | ----- | ------ | ------- | | daily | weekly | monthly |` }; async function handler(ctx) { const { range = "daily" } = ctx.req.param(); const { data: response } = await got_default(`${baseUrl}/api2/app/article/popular/${range}`); const list = response.RESULT.map((item) => { item = item.data; return { title: item.articleTitle, description: item.articleSummary, link: `${baseUrl}/${item.type || "ai"}/${item.id}.html`, pubDate: parseDate(item.publishTime, "x"), author: item.articleAuthor }; }); const result = (await Promise.allSettled(list.map((item) => parseArticle(item, cache_default.tryGet)))).filter((result$1) => result$1.status === "fulfilled").map((result$1) => result$1.value); return { title: `热门文章 - ${rangeMap[range]} - 人人都是产品经理`, link: baseUrl, item: result }; } //#endregion export { route };