rsshub
Version:
Make RSS Great Again!
81 lines (79 loc) • 2.19 kB
JavaScript
import "./dist-Bog6z_OM.mjs";
import "./config-MQ-7ebJ_.mjs";
import { t as ViewType } from "./types-gOySfSXJ.mjs";
import "./logger-C4avouvV.mjs";
import "./ofetch-DKl_Ma9g.mjs";
import "./parse-date-r5WDWHno.mjs";
import "./is-worker-DESPicPc.mjs";
import "./cache-SV6W5EPy.mjs";
import "./helpers-Bo4JQYdN.mjs";
import "./got-CO-ndVl2.mjs";
import { n as parseNewsList, r as rootUrl, t as parseArticle } from "./utils-C6vKUFF0.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 };