rsshub
Version:
Make RSS Great Again!
59 lines (57 loc) • 1.66 kB
JavaScript
import { n as init_esm_shims, t as __dirname } from "./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 art } from "./render-BQo6B4tL.mjs";
import { t as got_default } from "./got-KxxWdaxq.mjs";
import path from "node:path";
import { load } from "cheerio";
//#region lib/routes/techcrunch/news.ts
init_esm_shims();
const host = "https://techcrunch.com";
const route = {
path: "/news",
categories: ["new-media"],
example: "/techcrunch/news",
parameters: {},
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false
},
radar: [{ source: ["techcrunch.com/"] }],
name: "News",
maintainers: ["EthanWng97"],
handler,
url: "techcrunch.com/"
};
async function handler() {
const { data } = await got_default(`${host}/wp-json/wp/v2/posts`);
return {
title: "TechCrunch",
link: host,
description: "Reporting on the business of technology, startups, venture capital funding, and Silicon Valley.",
item: data.map((item) => {
const head = item.yoast_head_json;
const $ = load(item.content.rendered, null, false);
$(".wp-block-techcrunch-inline-cta").remove();
return {
title: item.title.rendered,
description: art(path.join(__dirname, "templates/description-31a2e1da.art"), {
head,
rendered: $.html()
}),
link: item.link,
pubDate: parseDate(item.date_gmt)
};
})
};
}
//#endregion
export { route };