rsshub
Version:
Make RSS Great Again!
45 lines (44 loc) • 1.46 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/acm/amturingaward.ts
const route = {
path: "/amturingaward",
categories: ["programming"],
example: "/acm/amturingaward",
name: "A.M.Turing Award Winners",
maintainers: ["nczitzk"],
handler
};
async function handler() {
const rootUrl = "https://amturing.acm.org";
const currentUrl = `${rootUrl}/byyear.cfm`;
const $ = load(await rofetch(currentUrl));
return {
title: "A.M. Turing Award Winners",
link: currentUrl,
item: await Promise.all($(".award-winners-list li").slice(0, 5).toArray().map(async (item) => {
const $item = $(item);
const year = $item.find("span").text().replaceAll(/[()]/g, "");
const winnersUrls = $item.find("a").toArray().map((a) => `${rootUrl}${$(a).attr("href")}`);
const winners = await Promise.all(winnersUrls.map((url) => rofetch(url)));
let description = "";
for (const winner of winners) {
const content = load(winner);
const image = content(".featured-photo").html() ?? "";
const column = content("#tertiary-navigation").parent();
content("#tertiary-navigation").remove();
description += image + column.html();
}
return {
pubDate: parseDate(`${year}-12-31`),
description,
title: year,
link: currentUrl,
guid: `${currentUrl}#${year}`
};
}))
};
}
//#endregion
export { route };