feat: add source xueqiu

This commit is contained in:
Ou
2024-10-21 02:18:36 +08:00
parent 2d9293c8ac
commit 8e99430d0f
5 changed files with 52 additions and 1 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

+2
View File
@@ -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,
+37
View File
@@ -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,
})
+1 -1
View File
@@ -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: "关注",
+12
View File
@@ -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<string, OriginSource>
export const sources = genSources()