rsshub
Version:
Make RSS Great Again!
42 lines (41 loc) • 1.22 kB
JavaScript
import { t as rofetch } from "./ofetch-W1aeTHCo.mjs";
import { t as parseDate } from "./parse-date-CjhZE69i.mjs";
import { t as cache_default } from "./cache-CiDoUSLo.mjs";
import { load } from "cheerio";
//#region lib/routes/ben-evans/recent.ts
const route = {
path: "/",
categories: ["blog"],
example: "/ben-evans",
name: "Essays",
maintainers: ["emdoe"],
handler
};
const rootUrl = "https://www.ben-evans.com";
async function handler() {
const url = `${rootUrl}/benedictevans/`;
const $ = load(await rofetch(url));
return {
title: "Benedict Evans",
link: url,
item: await Promise.all($("section > article").toArray().map((item) => {
const $item = $(item);
const title = $item.find(".BlogList-item-title").text();
const address = rootUrl + $item.find(".BlogList-item-title").attr("href");
const time = $item.find(".Blog-meta-item--date").text();
return cache_default.tryGet(address, async () => {
const capture = load(await rofetch(address));
return {
title,
author: "Benedict Evans",
description: capture(".col.sqs-col-12.span-12").html(),
link: address,
guid: address,
pubDate: parseDate(time)
};
});
}))
};
}
//#endregion
export { route };