rsshub
Version:
Make RSS Great Again!
36 lines (35 loc) • 1.12 kB
JavaScript
import { t as rofetch } from "./ofetch-W1aeTHCo.mjs";
import { t as parseDate } from "./parse-date-CjhZE69i.mjs";
import { load } from "cheerio";
//#region lib/routes/umass/ecenews.ts
const route = {
path: "/amherst/ecenews",
categories: ["university"],
example: "/umass/amherst/ecenews",
radar: [{ source: ["www.umass.edu/engineering/news"] }],
name: "College of Engineering - News",
maintainers: ["GammaPi"],
handler
};
async function handler() {
const baseUrl = "https://www.umass.edu";
const link = `${baseUrl}/engineering/news`;
const $ = load(await rofetch(link));
return {
title: "UMass College of Engineering - News",
link,
item: $(".views-row article.news").toArray().map((item) => {
const $item = $(item);
const a = $item.find(".news__title a");
return {
title: a.text().trim(),
description: $item.find(".news__summary").html(),
link: new URL(a.attr("href"), baseUrl).href,
pubDate: parseDate($item.find(".news__info .news__time").text()),
category: $item.find(".news__category a").toArray().map((c) => $(c).text())
};
})
};
}
//#endregion
export { route };