UNPKG

rsshub

Version:
73 lines (71 loc) 2.14 kB
import { n as init_esm_shims, t as __dirname } from "./esm-shims-CzJ_djXG.mjs"; import "./config-C37vj7VH.mjs"; import { t as ViewType } from "./types-D84BRIt4.mjs"; import "./dist-BInvbO1W.mjs"; import "./logger-Czu8UMNd.mjs"; import "./ofetch-BIyrKU3Y.mjs"; import { t as parseDate } from "./parse-date-BrP7mxXf.mjs"; import { t as cache_default } from "./cache-Bo__VnGm.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/fastbull/news.ts init_esm_shims(); 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 content = load((await got_default({ method: "get", url: item.link })).data); item.description = art(path.join(__dirname, "templates/description-b9030ea8.art"), { tips: item.description, description: content(".news-detail-content").html() }); return item; }))); return { title: "财经头条、财经新闻、最新资讯 - FastBull", link: currentUrl, item: items }; } //#endregion export { route };