UNPKG

rsshub

Version:
61 lines (59 loc) 2.04 kB
import "./dist-Bog6z_OM.mjs"; import "./config-MQ-7ebJ_.mjs"; import { t as ViewType } from "./types-gOySfSXJ.mjs"; import "./logger-C4avouvV.mjs"; import { t as ofetch_default } from "./ofetch-DKl_Ma9g.mjs"; import { t as parseDate } from "./parse-date-r5WDWHno.mjs"; import { t as md5 } from "./md5-Dce_BvZj.mjs"; import { t as timezone } from "./timezone-CA9Huotp.mjs"; import { Fragment, jsx, jsxs } from "hono/jsx/jsx-runtime"; import { renderToString } from "hono/jsx/dom/server"; //#region lib/routes/jiuyangongshe/community.tsx const render = (data) => renderToString(/* @__PURE__ */ jsxs(Fragment, { children: [data.cover ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("img", { src: data.cover }), /* @__PURE__ */ jsx("br", {})] }) : null, data.content] })); const route = { path: "/community", categories: ["finance"], view: ViewType.Articles, example: "/jiuyangongshe/community", maintainers: ["TonyRL"], name: "社群", handler, radar: [{ source: ["www.jiuyangongshe.com"] }] }; async function handler(ctx) { const link = `https://www.jiuyangongshe.com`; const time = String(Date.now()); return { title: "社群 - 韭研公社-研究共享,茁壮成长(原韭菜公社)", link, language: "zh-CN", item: (await ofetch_default("https://app.jiuyangongshe.com/jystock-app/api/v2/article/community", { method: "POST", headers: { platform: "3", timestamp: time, token: md5(`Uu0KfOB8iUP69d3c:${time}`) }, body: { category_id: "", limit: ctx.req.query("limit") ? Number.parseInt(ctx.req.query("limit"), 10) : 30, order: 0, start: 1, type: 0, back_garden: 0 } })).data.result.map((item) => ({ title: item.title, description: render({ cover: item.cover, content: item.content }), link: `${link}/a/${item.article_id}`, pubDate: timezone(parseDate(item.create_time, "YYYY-MM-DD HH:mm:ss"), 8), author: item.user.nickname, category: item.stock_list.map((stock) => stock.name) })) }; } //#endregion export { route };