feat: add source nowcoder (#116)
Co-authored-by: Ou <[email protected]>
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
Vendored
+1
@@ -18,6 +18,7 @@ declare module 'glob:./sources/{*.ts,**/index.ts}' {
|
||||
export const kaopu: typeof import('./sources/kaopu')
|
||||
export const kuaishou: typeof import('./sources/kuaishou')
|
||||
export const linuxdo: typeof import('./sources/linuxdo')
|
||||
export const nowcoder: typeof import('./sources/nowcoder')
|
||||
export const producthunt: typeof import('./sources/producthunt')
|
||||
export const solidot: typeof import('./sources/solidot')
|
||||
export const sputniknewscn: typeof import('./sources/sputniknewscn')
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
interface Res {
|
||||
data: {
|
||||
result: {
|
||||
id: string
|
||||
title: string
|
||||
type: number
|
||||
uuid: string
|
||||
hotValueFromDolphin: number
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default defineSource(async () => {
|
||||
const timestamp = Date.now()
|
||||
const url = `https://gw-c.nowcoder.com/api/sparta/hot-search/top-hot-pc?size=20&_=${timestamp}&t=`
|
||||
const res: Res = await myFetch(url)
|
||||
return res.data.result
|
||||
.map((k) => {
|
||||
let url, id
|
||||
if (k.type === 74) {
|
||||
url = `https://www.nowcoder.com/feed/main/detail/${k.uuid}`
|
||||
id = k.uuid
|
||||
} else if (k.type === 0) {
|
||||
url = `https://www.nowcoder.com/discuss/${k.id}`
|
||||
id = k.id
|
||||
}
|
||||
return {
|
||||
id,
|
||||
title: k.title,
|
||||
url,
|
||||
}
|
||||
})
|
||||
})
|
||||
@@ -31,6 +31,7 @@
|
||||
"kaopu": "kaopuxinwen",
|
||||
"jin10": "jinshishuju",
|
||||
"baidu": "baiduresou",
|
||||
"nowcoder": "niuke",
|
||||
"linuxdo-latest": "LINUX DO-zuixin",
|
||||
"linuxdo-hot": "LINUX DO-jinrizuire",
|
||||
"ghxi": "guoheboke"
|
||||
|
||||
@@ -286,6 +286,13 @@ export const originSources = {
|
||||
type: "hottest",
|
||||
home: "https://www.baidu.com",
|
||||
},
|
||||
"nowcoder": {
|
||||
name: "牛客",
|
||||
column: "china",
|
||||
color: "blue",
|
||||
type: "hottest",
|
||||
home: "https://www.nowcoder.com",
|
||||
},
|
||||
"linuxdo": {
|
||||
name: "LINUX DO",
|
||||
column: "tech",
|
||||
|
||||
@@ -350,6 +350,14 @@
|
||||
"color": "blue",
|
||||
"interval": 600000
|
||||
},
|
||||
"nowcoder": {
|
||||
"name": "牛客",
|
||||
"type": "hottest",
|
||||
"column": "china",
|
||||
"home": "https://www.nowcoder.com",
|
||||
"color": "blue",
|
||||
"interval": 600000
|
||||
},
|
||||
"linuxdo": {
|
||||
"redirect": "linuxdo-latest",
|
||||
"name": "LINUX DO",
|
||||
|
||||
Reference in New Issue
Block a user