UNPKG

rsshub

Version:
44 lines (42 loc) 1.33 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 "./cache-Bo__VnGm.mjs"; import "./helpers-DxBp0Pty.mjs"; import { t as got_default } from "./got-KxxWdaxq.mjs"; import { i as getArticleList, n as cookieJar, r as getArticle, t as baseUrl } from "./utils-DnpyJNX0.mjs"; import { load } from "cheerio"; //#region lib/routes/nature/news-and-comment.ts const route = { path: "/news-and-comment/:journal?", radar: [{ source: [ "nature.com/latest-news", "nature.com/news", "nature.com/" ], target: "/news" }], name: "Unknown", maintainers: ["y9c", "TonyRL"], handler, url: "nature.com/latest-news" }; async function handler(ctx) { const pageURL = `${baseUrl}/${ctx.req.param("journal")}/news-and-comment`; const pageCapture = load((await got_default(pageURL, { cookieJar })).data); const pageDescription = pageCapture("meta[name=description]").attr("content") || "Nature, a nature research journal"; let items = getArticleList(pageCapture); items = await Promise.all(items.map((item) => getArticle(item))); return { title: pageCapture("title").text(), description: pageDescription, link: pageURL, item: items }; } //#endregion export { route };