UNPKG

rsshub

Version:
55 lines (53 loc) 1.84 kB
import "./esm-shims-CzJ_djXG.mjs"; import "./config-C37vj7VH.mjs"; import "./dist-BInvbO1W.mjs"; import "./logger-Czu8UMNd.mjs"; import { t as ofetch_default } from "./ofetch-BIyrKU3Y.mjs"; import { t as parseDate } from "./parse-date-BrP7mxXf.mjs"; import { t as cache_default } from "./cache-Bo__VnGm.mjs"; import { load } from "cheerio"; import pMap from "p-map"; //#region lib/routes/anthropic/engineering.ts const route = { path: "/engineering", categories: ["programming"], example: "/anthropic/engineering", radar: [{ source: ["www.anthropic.com/engineering", "www.anthropic.com"] }], name: "Engineering", maintainers: ["TonyRL"], handler, url: "www.anthropic.com/engineering" }; async function handler() { const baseUrl = "https://www.anthropic.com"; const link = `${baseUrl}/engineering`; const $ = load(await ofetch_default(link)); const items = await pMap($("a[class^=\"ArticleList_cardLink__\"]").toArray().map((element) => { const $e = $(element); return { title: $e.find("h2, h3").text().trim(), link: `${baseUrl}${$e.attr("href")}` }; }), (item) => cache_default.tryGet(item.link, async () => { const $$1 = load(await ofetch_default(item.link)); const content = $$1("div[class^=\"Body_body__\"]"); content.find("img").each((_, e) => { const $e = $$1(e); $e.removeAttr("style srcset"); const src = $e.attr("src"); const newSrc = new URLSearchParams(src).get("/_next/image?url"); if (newSrc) $e.attr("src", newSrc); }); item.pubDate = parseDate($$1("p[class*=\"HeroEngineering_date__\"]").text().trim().replaceAll("Published ", "")); item.description = content.html(); return item; }), { concurrency: 5 }); return { title: "Anthropic Engineering", link, image: `${baseUrl}/images/icons/apple-touch-icon.png`, item: items }; } //#endregion export { route };