feat: add source nowcoder (#116)

Co-authored-by: Ou <[email protected]>
This commit is contained in:
urlyy
2025-04-04 19:22:23 +08:00
committed by GitHub
co-authored by Ou
parent aca476dd8f
commit 72f0c02f84
6 changed files with 50 additions and 0 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

+1
View File
@@ -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')
+33
View File
@@ -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,
}
})
})
+1
View File
@@ -31,6 +31,7 @@
"kaopu": "kaopuxinwen",
"jin10": "jinshishuju",
"baidu": "baiduresou",
"nowcoder": "niuke",
"linuxdo-latest": "LINUX DO-zuixin",
"linuxdo-hot": "LINUX DO-jinrizuire",
"ghxi": "guoheboke"
+7
View File
@@ -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",
+8
View File
@@ -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",