UNPKG

rsshub

Version:
55 lines (53 loc) 1.46 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 { t as rss_parser_default } from "./rss-parser-Dtop7M8f.mjs"; import { t as fetchArticle } from "./utils-BOmc80q7.mjs"; //#region lib/routes/apnews/rss.ts const HOME_PAGE = "https://apnews.com"; const route = { path: "/rss/:category?", categories: ["traditional-media"], example: "/apnews/rss/business", view: ViewType.Articles, parameters: { category: { description: "Category from the first segment of the corresponding site, or `index` for the front page.", default: "index" } }, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false }, radar: [{ source: ["apnews.com/:rss"], target: "/rss/:rss" }], name: "News", maintainers: [ "zoenglinghou", "mjysci", "TonyRL" ], handler }; async function handler(ctx) { const { rss = "index" } = ctx.req.param(); const url = `${HOME_PAGE}/${rss}.rss`; const res = await rss_parser_default.parseURL(url); const items = ctx.req.query("fulltext") === "true" ? await Promise.all(res.items.map((item) => fetchArticle(item))) : res; return { ...res, item: items }; } //#endregion export { route };