UNPKG

rsshub

Version:
56 lines (54 loc) 1.6 kB
import "./esm-shims-CzJ_djXG.mjs"; import "./config-C37vj7VH.mjs"; import "./dist-BInvbO1W.mjs"; import "./logger-Czu8UMNd.mjs"; import "./ofetch-BIyrKU3Y.mjs"; import { t as parseDate } from "./parse-date-BrP7mxXf.mjs"; import "./helpers-DxBp0Pty.mjs"; import { t as got_default } from "./got-KxxWdaxq.mjs"; import { load } from "cheerio"; //#region lib/routes/huggingface/blog.ts const route = { path: "/blog", categories: ["programming"], example: "/huggingface/blog", parameters: {}, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false }, radar: [{ source: ["huggingface.co/blog", "huggingface.co/"] }], name: "英文博客", maintainers: ["cesaryuan", "zcf0508"], handler, url: "huggingface.co/blog" }; async function handler() { const { body: response } = await got_default("https://huggingface.co/blog"); const $ = load(response); return { title: "Huggingface 英文博客", link: "https://huggingface.co/blog", item: $("div[data-target=\"BlogThumbnail\"]").toArray().map((item) => { const props = $(item).data("props"); const link = $(item).find("a").attr("href"); return { ...props, link }; }).map((item) => ({ title: item.blog.title, link: `https://huggingface.co${item.link}`, pubDate: parseDate(item.blog.publishedAt), author: item.blog.authors.map((author) => ({ name: author.user })), upvotes: item.blog.upvotes, image: new URL(item.blog.thumbnail, "https://huggingface.co").toString() })) }; } //#endregion export { route };