rsshub
Version:
Make RSS Great Again!
34 lines (33 loc) • 1.02 kB
JavaScript
import { t as parseDate } from "./parse-date-3kcy2Eau.mjs";
import { t as buildData } from "./common-config-DW8ZWC5w.mjs";
//#region lib/routes/polimi/news.ts
const route = {
path: "/news/:language?",
categories: ["university"],
example: "/polimi/news",
parameters: { language: "English language code en" },
name: "News",
maintainers: ["exuanbo"],
handler
};
async function handler(ctx) {
const { language } = ctx.req.param();
const link = language === "en" ? "https://www.polimi.it/en/the-politecnico/news" : "https://www.polimi.it/il-politecnico/news";
return await buildData({
link,
url: link,
title: "Polimi News",
item: {
item: ".card--editorial-photo",
title: ($) => $(".card-title").text(),
link: ($) => "https://www.polimi.it" + $(".card-footer a").attr("href"),
description: ($) => $(".news-bodytext").html(),
pubDate: ($) => {
const datetime = $("time").attr("datetime");
return datetime ? parseDate(datetime) : void 0;
}
}
});
}
//#endregion
export { route };