rsshub
Version:
Make RSS Great Again!
33 lines (32 loc) • 1.11 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/simonsfoundation/recommend.ts
const baseUrl = "https://www.simonsfoundation.org/news/what-were-reading";
const route = {
path: "/recommend",
categories: ["new-media"],
example: "/simonsfoundation/recommend",
name: "What We're Reading",
maintainers: ["emdoe"],
handler
};
async function handler() {
const $ = load(await rofetch(baseUrl));
return {
title: `Simons Foundation | What We're Reading`,
link: baseUrl,
description: `Simons Foundation - What We're Reading`,
item: $(".o-dated-list__row").toArray().map((item) => {
const $item = $(item);
return {
title: $item.find(".m-post__title").text(),
description: $item.find(".m-post__aside").html(),
pubDate: parseDate(`${$item.find(".o-dated-list__day").text()} ${$item.find(".o-dated-list__month").text()} ${$item.find(".o-dated-list__year").text()}`),
link: $item.find(".m-post__block-link").attr("href")
};
})
};
}
//#endregion
export { route };