rsshub
Version:
Make RSS Great Again!
74 lines (72 loc) • 2.33 kB
JavaScript
import "./dist-Bog6z_OM.mjs";
import "./config-MQ-7ebJ_.mjs";
import { t as ViewType } from "./types-gOySfSXJ.mjs";
import "./logger-C4avouvV.mjs";
import "./ofetch-DKl_Ma9g.mjs";
import { t as parseDate } from "./parse-date-r5WDWHno.mjs";
import "./is-worker-DESPicPc.mjs";
import { t as cache_default } from "./cache-SV6W5EPy.mjs";
import "./helpers-Bo4JQYdN.mjs";
import { t as got_default } from "./got-CO-ndVl2.mjs";
import { Fragment, jsx, jsxs } from "hono/jsx/jsx-runtime";
import { load } from "cheerio";
import { renderToString } from "hono/jsx/dom/server";
import { raw } from "hono/html";
//#region lib/routes/fastbull/news.tsx
const route = {
path: "/news",
categories: ["finance"],
view: ViewType.Articles,
example: "/fastbull/news",
parameters: {},
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false
},
radar: [{ source: ["fastbull.com/cn/news", "fastbull.com/cn"] }],
name: "News",
maintainers: ["nczitzk"],
handler,
url: "fastbull.com/news"
};
async function handler() {
const rootUrl = "https://www.fastbull.com";
const currentUrl = `${rootUrl}/cn/news`;
const $ = load((await got_default({
method: "get",
url: currentUrl
})).data);
let items = $(".trending_type").toArray().map((item) => {
item = $(item);
return {
title: item.find(".title").text(),
link: `${rootUrl}${item.attr("href")}`,
author: item.find(".resource").text(),
description: item.find(".tips").text(),
pubDate: parseDate(Number.parseInt(item.find(".new_time").attr("data-date")))
};
});
items = await Promise.all(items.map((item) => cache_default.tryGet(item.link, async () => {
const detailHtml = load((await got_default({
method: "get",
url: item.link
})).data)(".news-detail-content").html();
item.description = renderToString(/* @__PURE__ */ jsxs(Fragment, { children: [item.description ? /* @__PURE__ */ jsxs(Fragment, { children: [
/* @__PURE__ */ jsx("b", { children: "摘要" }),
":",
/* @__PURE__ */ jsx("p", { children: item.description })
] }) : null, detailHtml ? raw(detailHtml) : null] }));
return item;
})));
return {
title: "财经头条、财经新闻、最新资讯 - FastBull",
link: currentUrl,
item: items
};
}
//#endregion
export { route };