UNPKG

rsshub

Version:
67 lines (65 loc) 1.88 kB
import "./esm-shims-CzJ_djXG.mjs"; import "./config-C37vj7VH.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/disinfo/publications.ts const route = { path: "/publications", categories: ["new-media"], example: "/disinfo/publications", parameters: {}, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false }, radar: [{ source: ["disinfo.eu/"] }], name: "Publications", maintainers: ["nczitzk"], handler, url: "disinfo.eu/" }; async function handler() { const currentUrl = `https://www.disinfo.eu/publications`; const $ = load((await got_default({ method: "get", url: currentUrl })).data); const list = $(".elementor-heading-title a").toArray().map((item) => { item = $(item); return { title: item.text(), link: item.attr("href") }; }); const items = await Promise.all(list.map((item) => cache_default.tryGet(item.link, async () => { const content = load((await got_default({ method: "get", url: item.link })).data); content(".wp-block-spacer").remove(); content(".elementor-widget-container p").eq(0).remove(); content("img").each(function() { content(this).attr("src", content(this).attr("data-lazy-src")); }); item.description = content(".elementor-widget-theme-post-content").html(); item.pubDate = parseDate(content("meta[property=\"article:modified_time\"]").attr("content")); return item; }))); return { title: $("title").text(), link: currentUrl, item: items }; } //#endregion export { route };