rsshub
Version:
Make RSS Great Again!
82 lines (80 loc) • 2.42 kB
JavaScript
import { n as init_esm_shims, t as __dirname } from "./esm-shims-CzJ_djXG.mjs";
import { t as config } from "./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 { t as timezone } from "./timezone-D8cuwzTY.mjs";
import path from "node:path";
//#region lib/routes/jin10/index.ts
init_esm_shims();
const route = {
path: "/:important?",
categories: ["finance"],
view: ViewType.Notifications,
example: "/jin10",
parameters: { important: "只看重要,任意值开启,留空关闭" },
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false
},
radar: [{
source: ["jin10.com/"],
target: ""
}],
name: "市场快讯",
maintainers: ["laampui"],
handler,
url: "jin10.com/"
};
async function handler(ctx) {
const { important = false } = ctx.req.param();
const item = (await cache_default.tryGet("jin10:index", async () => {
const { data: response } = await got_default("https://flash-api.jin10.com/get_flash_list", {
headers: {
"x-app-id": "bVBF4FyRTn5NJF5n",
"x-version": "1.0.0"
},
searchParams: {
channel: "-8200",
vip: "1"
}
});
return response.data.filter((item$1) => item$1.type !== 1);
}, config.cache.routeExpire, false)).map((item$1) => {
const titleMatch = item$1.data.content.match(/^【(.*?)】/);
let title;
let content = item$1.data.content;
if (titleMatch) {
title = titleMatch[1];
content = content.replace(titleMatch[0], "");
} else title = item$1.data.vip_title || item$1.data.content;
return {
title,
description: art(path.join(__dirname, "templates/description-8c5d2b6c.art"), {
content,
pic: item$1.data.pic
}),
pubDate: timezone(parseDate(item$1.time), 8),
link: item$1.data.link,
guid: `jin10:index:${item$1.id}`,
important: item$1.important
};
});
return {
title: "金十数据",
link: "https://www.jin10.com/",
item: important ? item.filter((item$1) => item$1.important) : item
};
}
//#endregion
export { route };