UNPKG

rsshub

Version:
65 lines (63 loc) 1.8 kB
import "./dist-Bog6z_OM.mjs"; import "./config-MQ-7ebJ_.mjs"; import "./logger-C4avouvV.mjs"; import "./ofetch-DKl_Ma9g.mjs"; import { t as parseDate } from "./parse-date-r5WDWHno.mjs"; import "./helpers-Bo4JQYdN.mjs"; import { t as got_default } from "./got-CO-ndVl2.mjs"; import { i as randomString, n as encryptAES, r as getHeaders, t as decryptAES } from "./utils-C6U2trel.mjs"; //#region lib/routes/ainvest/article.ts const route = { path: "/article", categories: ["finance"], example: "/ainvest/article", parameters: {}, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false }, radar: [{ source: ["ainvest.com/news"] }], name: "Latest Article", maintainers: ["TonyRL"], handler, url: "ainvest.com/news" }; async function handler(ctx) { const key = randomString(16); const { data: response } = await got_default.post("https://api.ainvest.com/gw/socialcenter/v1/edu/article/listArticle", { headers: getHeaders(key), searchParams: { timestamp: Date.now() }, data: encryptAES(JSON.stringify({ batch: ctx.req.query("limit") ? Number.parseInt(ctx.req.query("limit"), 10) : 30, startId: null, tags: { in: [ "markettrends", "premarket", "companyinsights", "macro" ], and: ["web", "creationplatform"] } }), key) }); const { data } = JSON.parse(decryptAES(response, key)); return { title: "AInvest - Latest Articles", link: "https://www.ainvest.com/news", language: "en", item: data.map((item) => ({ title: item.title, description: item.content, link: item.sourceUrl, pubDate: parseDate(item.postDate, "x"), category: [item.nickName, ...item.tags.map((tag) => tag.code)] })) }; } //#endregion export { route };