UNPKG

rsshub

Version:
49 lines (48 loc) 1.41 kB
import { t as parseDate } from "./parse-date-3kcy2Eau.mjs"; import { t as got_default } from "./got-DUpa1V3-.mjs"; import { load } from "cheerio"; //#region lib/routes/mit/hanlab.ts const route = { path: "/hanlab/blog", categories: ["blog"], example: "/mit/hanlab/blog", parameters: {}, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false }, radar: [{ source: ["hanlab.mit.edu/blog"] }], name: "HAN Lab Blog", maintainers: ["johan456789"], handler, description: "MIT HAN Lab pioneers research in efficient AI, advancing algorithms and hardware to make generative models faster, smarter, and more accessible." }; async function handler() { const rootUrl = "https://hanlab.mit.edu"; const currentUrl = `${rootUrl}/blog`; const response = await got_default(currentUrl); const $ = load(response.data); return { title: "MIT HAN Lab Blog", link: currentUrl, item: $("a.post-card-wrapper").toArray().map((item) => { const el = $(item); const title = el.find("h3.text-title").text().trim(); const link = new URL(el.attr("href") ?? "", rootUrl).href; const description = el.find("p.text-tldr").html(); const dateText = el.find("div.text-date").text(); return { title, link, description, pubDate: parseDate(dateText) }; }) }; } //#endregion export { route };