rsshub
Version:
Make RSS Great Again!
37 lines (36 loc) • 1.15 kB
JavaScript
import { t as rofetch } from "./ofetch-U0CdpE2g.mjs";
import { t as parseDate } from "./parse-date-3kcy2Eau.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 response = await rofetch(link);
const $ = load(response);
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 };