diff --git a/public/icons/xueqiu.png b/public/icons/xueqiu.png new file mode 100644 index 0000000..5fa95f4 Binary files /dev/null and b/public/icons/xueqiu.png differ diff --git a/server/sources/index.ts b/server/sources/index.ts index e473fec..35edad0 100644 --- a/server/sources/index.ts +++ b/server/sources/index.ts @@ -12,6 +12,7 @@ import douyin from "./douyin" import toutiao from "./toutiao" import cls from "./cls" import sputniknewscn from "./sputniknewscn" +import xueqiu from "./xueqiu" import type { SourceGetter } from "#/types" export const sourcesGetters = { @@ -24,6 +25,7 @@ export const sourcesGetters = { cankaoxiaoxi, sputniknewscn, ...wallstreetcn, + ...xueqiu, douyin, ...cls, toutiao, diff --git a/server/sources/xueqiu.ts b/server/sources/xueqiu.ts new file mode 100644 index 0000000..34fbcbe --- /dev/null +++ b/server/sources/xueqiu.ts @@ -0,0 +1,37 @@ +interface StockRes { + data: { + items: + { + code: string + name: string + percent: number + exchange: string + // 1 + ad: number + }[] + + } +} + +const hotstock = defineSource(async () => { + const url = "https://stock.xueqiu.com/v5/stock/hot_stock/list.json?size=30&_type=10&type=10" + const cookie = (await $fetch.raw("https://xueqiu.com")).headers.getSetCookie() + const res: StockRes = await $fetch(url, { + headers: { + cookie: cookie.join("; "), + }, + }) + return res.data.items.filter(k => !k.ad).map(k => ({ + id: k.code, + url: `https://xueqiu.com/s/${k.code}`, + title: k.name, + extra: { + info: `${k.percent}%`, + }, + })) +}) + +export default defineSource({ + "xueqiu": hotstock, + "xueqiu-hotstock": hotstock, +}) diff --git a/shared/metadata.ts b/shared/metadata.ts index ea01431..7058163 100644 --- a/shared/metadata.ts +++ b/shared/metadata.ts @@ -19,7 +19,7 @@ const originMetadata: Metadata = { }, finance: { name: "财经", - sources: ["cls-telegraph", "cls-depth", "wallstreetcn", "wallstreetcn-hot", "wallstreetcn-news"], + sources: ["cls-telegraph", "cls-depth", "wallstreetcn", "wallstreetcn-hot", "wallstreetcn-news", "xueqiu-hotstock"], }, focus: { name: "关注", diff --git a/shared/sources.ts b/shared/sources.ts index e59c31c..a46a787 100644 --- a/shared/sources.ts +++ b/shared/sources.ts @@ -145,6 +145,18 @@ export const originSources = { }, }, }, + "xueqiu": { + name: "雪球", + color: "blue", + home: "https://xueqiu.com", + sub: { + hotstock: { + title: "热门股票", + interval: Time.Realtime, + type: "hottest", + }, + }, + }, } as const satisfies Record export const sources = genSources()