mirror of
https://github.com/ourongxing/newsnow.git
synced 2025-01-18 18:59:15 +08:00
feat(source): add jin10
* feat(source): add jin10 * chore: update source jin10 --------- Co-authored-by: onlylhf <542182964@qq.com>
This commit is contained in:
parent
a29657033a
commit
4daeb0edd4
BIN
public/icons/jin10.png
Normal file
BIN
public/icons/jin10.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
1
server/glob.d.ts
vendored
1
server/glob.d.ts
vendored
@ -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
46
server/sources/jin10.ts
Normal 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 && "✰",
|
||||
},
|
||||
}
|
||||
})
|
||||
})
|
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user