UNPKG

rsshub

Version:
45 lines (43 loc) 1.45 kB
import "./esm-shims-CzJ_djXG.mjs"; import "./config-C37vj7VH.mjs"; import "./dist-BInvbO1W.mjs"; import "./logger-Czu8UMNd.mjs"; import "./ofetch-BIyrKU3Y.mjs"; import "./parse-date-BrP7mxXf.mjs"; import "./cache-Bo__VnGm.mjs"; import "./helpers-DxBp0Pty.mjs"; import "./render-BQo6B4tL.mjs"; import { t as got_default } from "./got-KxxWdaxq.mjs"; import { t as utils_default } from "./utils-CiJlffWL.mjs"; //#region lib/routes/thepaper/sidebar.ts const sections = { hotNews: "澎湃热榜", financialInformationNews: "澎湃财讯", morningEveningNews: "早晚报" }; const route = { path: "/sidebar/:sec?", radar: [{ source: ["thepaper.cn/"], target: "/sidebar" }], name: "侧边栏", categories: ["new-media"], example: "/thepaper/sidebar", parameters: { sec: "侧边栏 id,可选 `hotNews` 即 澎湃热榜、`financialInformationNews` 即 澎湃财讯、`morningEveningNews` 即 早晚报,默认为 `hotNews`" }, maintainers: ["bigfei"], handler, url: "thepaper.cn/" }; async function handler(ctx) { const { sec = "hotNews" } = ctx.req.param(); const list = (await got_default(`https://cache.thepaper.cn/contentapi/wwwIndex/rightSidebar`)).data.data[sec]; const items = await Promise.all(list.filter((item) => item.contId).map((item) => utils_default.ProcessItem(item, ctx))); return { title: `澎湃新闻 - ${sections[sec]}`, item: items, link: "https://www.thepaper.cn" }; } //#endregion export { route };