UNPKG

rsshub

Version:
56 lines (54 loc) 1.87 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 "./md5-C8GRvctM.mjs"; import { t as cache_default } from "./cache-Bo__VnGm.mjs"; import { i as parseReviews, n as fixImages, r as headers, t as baseUrl } from "./utils-BnUyXqXW.mjs"; import { load } from "cheerio"; //#region lib/routes/techpowerup/index.ts const route = { path: "/", radar: [{ source: ["techpowerup.com/"] }], name: "Latest Content", maintainers: ["TonyRL"], example: "/techpowerup", handler, url: "www.techpowerup.com/" }; async function handler() { const $ = load(await ofetch_default(baseUrl, { headers })); const list = $(".newspost").toArray().map((item) => { const $item = $(item); const a = $item.find("h1 a"); const date = $item.find("time").attr("datetime"); return { title: a.text(), link: baseUrl + a.attr("href"), pubDate: date ? parseDate(date) : null, author: $item.find(".byline address").text(), category: $item.find(".byline .flags span").toArray().map((item$1) => $(item$1).text().trim()) }; }); return { title: "TechPowerUp", link: baseUrl, language: "en", image: "https://tpucdn.com/apple-touch-icon-v1684568903519.png", item: await Promise.all(list.map((item) => cache_default.tryGet(item.link, async () => { const $$1 = load(await ofetch_default(item.link, { headers })); fixImages($$1); if (item.link.includes("/review/")) { await parseReviews($$1, item); return item; } item.description = $$1(".newspost .text").html(); item.category = [...new Set([...item.category, ...$$1(".tags li a").toArray().map((item$1) => $$1(item$1).text())])]; return item; }))) }; } //#endregion export { route };