feat(source): add jin10

* feat(source): add jin10
* chore: update source jin10

---------

Co-authored-by: onlylhf <542182964@qq.com>
This commit is contained in:
Ou 2024-10-27 00:06:01 +08:00 committed by GitHub
parent a29657033a
commit 4daeb0edd4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 53 additions and 0 deletions

BIN
public/icons/jin10.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

1
server/glob.d.ts vendored
View File

@ -12,6 +12,7 @@ declare module 'glob:./sources/{*.ts,**/index.ts}' {
export const github: typeof import('./sources/github')
export const hackernews: typeof import('./sources/hackernews')
export const ithome: typeof import('./sources/ithome')
export const jin10: typeof import('./sources/jin10')
export const kaopu: typeof import('./sources/kaopu')
export const kuaishou: typeof import('./sources/kuaishou')
export const producthunt: typeof import('./sources/producthunt')

46
server/sources/jin10.ts Normal file
View File

@ -0,0 +1,46 @@
interface Jin10Item {
id: string
time: string
type: number
data: {
pic?: string
title?: string
source?: string
content?: string
source_link?: string
vip_title?: string
lock?: boolean
vip_level?: number
vip_desc?: string
}
important: number
tags: string[]
channel: number[]
remark: any[]
}
export default defineSource(async () => {
const timestamp = Date.now()
const url = `https://www.jin10.com/flash_newest.js?t=${timestamp}`
const rawData: string = await $fetch(url)
// eslint-disable-next-line no-new-func
const jsonStr = new Function(`${rawData}\nreturn newest;`)
const data: Jin10Item[] = jsonStr()
return data.filter(k => (k.data.title || k.data.content) && !k.channel?.includes(5)).map((k) => {
const text = (k.data.title || k.data.content)!.replace(/<\/?b>/g, "")
const [,title, desc] = text.match(/^【([^】]*)】(.*)$/) ?? []
return {
id: k.id,
title: title ?? text,
pubDate: parseRelativeDate(k.time, "Asia/Shanghai").valueOf(),
url: `https://flash.jin10.com/detail/${k.id}`,
extra: {
hover: desc,
info: !!k.important && "✰",
},
}
})
})

View File

@ -266,6 +266,12 @@ export const originSources = {
desc: "不一定靠谱,多看多思考",
home: "https://kaopu.news/",
},
"jin10": {
name: "金十数据",
column: "finance",
color: "red",
home: "https://www.jin10.com",
},
} as const satisfies Record<string, OriginSource>
export const sources = genSources()