UNPKG

rsshub

Version:
82 lines (80 loc) 2.22 kB
import "./esm-shims-CzJ_djXG.mjs"; import "./config-C37vj7VH.mjs"; import { t as ViewType } from "./types-D84BRIt4.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 "./got-KxxWdaxq.mjs"; import { n as parseNewsList, r as rootUrl, t as parseArticle } from "./utils-CFAzYdlg.mjs"; import pMap from "p-map"; //#region lib/routes/bloomberg/index.ts const siteTitleMapping = { "/": "News", bpol: "Politics", bbiz: "Business", markets: "Markets", technology: "Technology", green: "Green", wealth: "Wealth", pursuits: "Pursuits", bview: "Opinion", equality: "Equality", businessweek: "Businessweek", citylab: "CityLab" }; const route = { path: "/:site?", categories: ["finance"], view: ViewType.Articles, example: "/bloomberg/bbiz", parameters: { site: { description: "Site ID, can be found below", options: Object.keys(siteTitleMapping).map((key) => ({ value: key, label: siteTitleMapping[key] })) } }, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: true, supportBT: false, supportPodcast: false, supportScihub: false }, name: "Bloomberg Site", maintainers: ["bigfei"], description: ` | Site ID | Title | | ------------ | ------------ | | / | News | | bpol | Politics | | bbiz | Business | | markets | Markets | | technology | Technology | | green | Green | | wealth | Wealth | | pursuits | Pursuits | | bview | Opinion | | equality | Equality | | businessweek | Businessweek | | citylab | CityLab | `, handler }; async function handler(ctx) { const site = ctx.req.param("site"); const currentUrl = site ? `${rootUrl}/${site}/sitemap_news.xml` : `${rootUrl}/sitemap_news.xml`; const items = await pMap(await parseNewsList(currentUrl, ctx), (item) => parseArticle(item), { concurrency: 1 }); return { title: `Bloomberg - ${siteTitleMapping[site ?? "/"]}`, link: currentUrl, item: items }; } //#endregion export { route };