rsshub
Version:
Make RSS Great Again!
54 lines (52 loc) • 1.51 kB
JavaScript
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/cpuid/news.ts
const newsUrl = "https://www.cpuid.com/news.html";
const route = {
path: "/news",
categories: ["program-update"],
example: "/cpuid/news",
parameters: {},
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false
},
radar: [{ source: ["cpuid.com/news.html", "cpuid.com/"] }],
name: "News",
maintainers: [],
handler,
url: "cpuid.com/news.html"
};
async function handler() {
const $ = load((await got_default(newsUrl)).data);
const items = $(".block_100 .js-block-news").toArray().map((item) => {
item = $(item);
return {
title: item.find(".information a").text(),
description: item.find(".description").html(),
link: item.find(".information a").attr("href"),
pubDate: parseDate(item.find("time[itemprop=dateCreated]").attr("datetime"))
};
});
return {
title: $("head title").text(),
description: $("head description").attr("content"),
link: newsUrl,
image: $("link[rel=apple-touch-icon-precomposed]").attr("href"),
item: items,
language: $("html").attr("lang")
};
}
//#endregion
export { route };