feat: add source xueqiu
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
@@ -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,
|
||||
|
||||
@@ -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
@@ -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: "关注",
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user