UNPKG

rsshub

Version:
37 lines (36 loc) 1.1 kB
import { t as rofetch } from "./ofetch-W1aeTHCo.mjs"; import { t as parseDate } from "./parse-date-CjhZE69i.mjs"; import { load } from "cheerio"; //#region lib/routes/mathunion/fields-medal.ts const route = { path: "/fields-medal", categories: ["new-media"], example: "/mathunion/fields-medal", name: "Fields Medal", maintainers: ["nczitzk"], handler }; async function handler() { const rootUrl = "https://www.mathunion.org"; const currentUrl = `${rootUrl}/imu-awards/fields-medal`; const $ = load(await rofetch(currentUrl)); const items = $(".paragraph--type--section-with-lists").eq(0).find(".list__group").toArray().map((item) => { const $item = $(item); const year = $item.find("h3").text(); const detailUrl = $item.find("ul li a").attr("href"); $item.find("h3, ul").remove(); return { title: year, link: detailUrl ? new URL(detailUrl, rootUrl).href : currentUrl, description: `<ul>${$item.html()}</ul>`, pubDate: parseDate(`${year}-12-31`) }; }); return { title: $("title").text(), link: currentUrl, item: items }; } //#endregion export { route };