rsshub
Version:
Make RSS Great Again!
36 lines (35 loc) • 1.24 kB
JavaScript
import { t as rofetch } from "./ofetch-W1aeTHCo.mjs";
import { load } from "cheerio";
//#region lib/routes/umass/ipoevents.ts
const route = {
path: "/amherst/ipoevents",
categories: ["university"],
example: "/umass/amherst/ipoevents",
radar: [{ source: ["www.umass.edu/global-affairs/events"] }],
name: "Office of Global Affairs - International Student and Scholar Services Events",
maintainers: ["GammaPi"],
handler
};
async function handler() {
const baseUrl = "https://www.umass.edu";
const link = `${baseUrl}/global-affairs/events?field_event_types_target_id%5B13%5D=13`;
const $ = load(await rofetch(link));
const items = $(".teaser-item.event").toArray().map((item) => {
const $item = $(item);
const a = $item.find("a.text-md");
const date = `${$item.find(".date-box-day").text().trim()} ${$item.find(".date-box-month").text().trim()} ${$item.find(".date-wrapper").text().trim()}`;
return {
title: a.text().trim(),
description: `${date}<br>${$item.find(".summary").html()}`,
link: new URL(a.attr("href"), baseUrl).href,
category: $item.find(".tag").toArray().map((tag) => $(tag).text().trim())
};
});
return {
title: $("head title").text(),
link,
item: items
};
}
//#endregion
export { route };