UNPKG

rsshub

Version:
55 lines (53 loc) 1.78 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 { t as parseDate } from "./parse-date-BrP7mxXf.mjs"; import { t as cache_default } from "./cache-Bo__VnGm.mjs"; import "./helpers-DxBp0Pty.mjs"; import { t as got_default } from "./got-KxxWdaxq.mjs"; import { load } from "cheerio"; //#region lib/routes/reuters/investigates.ts const route = { path: "/investigates", categories: ["traditional-media"], view: ViewType.Articles, example: "/reuters/investigates", parameters: {}, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false }, name: "Inverstigates", maintainers: ["LyleLee"], handler }; async function handler() { const currentUrl = `https://www.reuters.com/investigates/`; const $ = load((await got_default(currentUrl)).data); const list = $("article.section-article-container.row").toArray().map((item) => ({ title: $(item).find("h2.subtitle").text(), link: $(item).find("a.row.d-flex").prop("href") })); const items = await Promise.all(list.map((item) => cache_default.tryGet(item.link, async () => { const content = load((await got_default(item.link)).data); item.title = content("title").text(); item.description = content("article.special-report").html(); item.pubDate = parseDate(content("time[itemprop=\"datePublished\"]").attr("datetime")); item.author = content("meta[property=\"og:article:publisher\"]").attr("content"); return item; }))); return { title: $("h1.series-subtitle").text(), link: currentUrl, item: items }; } //#endregion export { route };