UNPKG

rsshub

Version:
44 lines (42 loc) 1.32 kB
import "./dist-Bog6z_OM.mjs"; import "./config-MQ-7ebJ_.mjs"; import "./logger-C4avouvV.mjs"; import "./ofetch-DKl_Ma9g.mjs"; import { t as parseDate } from "./parse-date-r5WDWHno.mjs"; import "./helpers-Bo4JQYdN.mjs"; import { t as got_default } from "./got-CO-ndVl2.mjs"; //#region lib/routes/kaopu/news.ts const route = { path: "/news/:language?", categories: ["new-media"], example: "/kaopu/news/zh-hans", parameters: { language: "语言" }, radar: [{ source: ["kaopu.news/"] }], name: "全部", maintainers: ["fashioncj"], description: `| 简体中文 | 繁体中文 | | ------- | -------- | | zh-hans | zh-hant | `, handler }; async function handler(ctx) { const { language } = ctx.req.param(); const currentUrl = `https://kaopu.news/${language === "zh-hant" ? "zh-hant" : "index"}.html`; const items = (await got_default({ method: "get", url: `https://kaopustorage.blob.core.windows.net/jsondata/news_list_beta_han${language === "zh-hant" ? "t" : "s"}_0.json` })).data.map((item) => ({ link: item.link, title: item.title, author: item.publisher, pubDate: parseDate(item.pubDate), description: `<p>${item.description}</p>` })); return { title: language === "zh-hant" ? "靠譜新聞" : "靠谱新闻", link: currentUrl, item: items }; } //#endregion export { route };