UNPKG

rsshub

Version:
80 lines (78 loc) 2.42 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 { t as timezone } from "./timezone-D8cuwzTY.mjs"; import { load } from "cheerio"; //#region lib/routes/unipd/ilbolive/news.ts const route = { path: "/ilbolive/news", name: "Il Bo Live - News", url: "ilbolive.unipd.it/it/news", maintainers: ["Gexi0619"], example: "/unipd/ilbolive/news", parameters: {}, description: "Il Bo Live - News", categories: ["university"], features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportRadar: true, supportBT: false, supportPodcast: false, supportScihub: false }, radar: [{ source: ["ilbolive.unipd.it/it/news"], target: "/ilbolive/news" }], handler }; async function handler() { const baseUrl = "https://ilbolive.unipd.it"; const homeUrl = `${baseUrl}/it/news`; const $ = load((await got_default(homeUrl)).data); const items = $("#list-nodes .col.-s-6").toArray().map((el) => { const item = $(el); return { title: item.find(".title a").text().trim(), link: baseUrl + item.find(".title a").attr("href"), category: item.find(".category").text().trim(), enclosure_url: baseUrl + item.find(".photo img").attr("src"), enclosure_type: "image/jpeg" }; }); return { title: "Il Bo Live - News", link: homeUrl, item: await Promise.all(items.map((item) => cache_default.tryGet(item.link, async () => { const $$1 = load((await got_default(item.link)).data); const article = $$1("article.post-generic"); article.find("img").each((_, el) => { const img = $$1(el); const src = img.attr("src"); if (src && src.startsWith("/")) img.attr("src", baseUrl + src); img.attr("style", "max-width: 100%; height: auto;"); }); const datetime = article.find("time.date").attr("datetime"); const pubDate = datetime ? timezone(parseDate(datetime), 0) : void 0; const author = article.find(".author a").text().trim(); article.find(".header").remove(); return { ...item, description: article.html() ?? "", pubDate, author }; }))), language: "it" }; } //#endregion export { route };