UNPKG

rsshub

Version:
49 lines (47 loc) 1.65 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 { t as cache_default } from "./cache-Bo__VnGm.mjs"; import "./helpers-DxBp0Pty.mjs"; import "./render-BQo6B4tL.mjs"; import "./got-KxxWdaxq.mjs"; import { t as invalid_parameter_default } from "./invalid-parameter-rr4AgGpp.mjs"; import { i as getProviderList } from "./utils-Di9BPU21.mjs"; //#region lib/routes/yahoo/news/provider-helper.ts const route = { path: "/news/providers/:region/list", categories: ["new-media"], example: "/yahoo/news/providers/tw/list", parameters: { region: "地区, 同路由\"新闻来源\"中的支持地区, 即 hk 或 tw" }, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false }, radar: [{ source: ["hk.news.yahoo.com/"] }, { source: ["tw.news.yahoo.com/"] }], name: "新聞來源列表", maintainers: ["TonyRL", "williamgateszhao"], handler }; async function handler(ctx) { const region = ctx.req.param("region"); if (!["hk", "tw"].includes(region)) throw new invalid_parameter_default(`Unknown region: ${region}`); const items = (await getProviderList(region, cache_default.tryGet)).map((provider) => ({ ...provider, description: provider.key })); return { title: "Yahoo 新聞 - 新聞來源列表", link: `https://${region}.news.yahoo.com`, image: "https://s.yimg.com/cv/apiv2/social/images/yahoo_default_logo-1200x1200.png", item: items }; } //#endregion export { route };