feat: add source 少数派 & 稀土掘金 (#127)

resolve  #42, resolve #118, resolve #48
This commit is contained in:
urlyy
2025-04-12 21:57:53 +08:00
committed by GitHub
parent f907cada31
commit affd63db19
7 changed files with 80 additions and 3 deletions
+2
View File
@@ -15,6 +15,7 @@ declare module 'glob:./sources/{*.ts,**/index.ts}' {
export const hackernews: typeof import('./sources/hackernews')
export const ithome: typeof import('./sources/ithome')
export const jin10: typeof import('./sources/jin10')
export const juejin: typeof import('./sources/juejin')
export const kaopu: typeof import('./sources/kaopu')
export const kuaishou: typeof import('./sources/kuaishou')
export const linuxdo: typeof import('./sources/linuxdo')
@@ -24,6 +25,7 @@ declare module 'glob:./sources/{*.ts,**/index.ts}' {
export const smzdm: typeof import('./sources/smzdm')
export const solidot: typeof import('./sources/solidot')
export const sputniknewscn: typeof import('./sources/sputniknewscn')
export const sspai: typeof import('./sources/sspai')
export const thepaper: typeof import('./sources/thepaper')
export const tieba: typeof import('./sources/tieba')
export const toutiao: typeof import('./sources/toutiao')
+21
View File
@@ -0,0 +1,21 @@
interface Res {
data: {
content: {
title: string
content_id: string
}
}[]
}
export default defineSource(async () => {
const url = `https://api.juejin.cn/content_api/v1/content/article_rank?category_id=1&type=hot&spider=0`
const res: Res = await myFetch(url)
return res.data.map((k) => {
const url = `https://juejin.cn/post/${k.content.content_id}`
return {
id: k.content.content_id,
title: k.content.title,
url,
}
})
})
+1 -2
View File
@@ -5,8 +5,7 @@ interface Res {
title: string
type: number
uuid: string
hotValueFromDolphin: number
}
}[]
}
}
+21
View File
@@ -0,0 +1,21 @@
interface Res {
data: {
id: number
title: string
}[]
}
export default defineSource(async () => {
const timestamp = Date.now()
const limit = 30
const url = `https://sspai.com/api/v1/article/tag/page/get?limit=${limit}&offset=0&created_at=${timestamp}&tag=%E7%83%AD%E9%97%A8%E6%96%87%E7%AB%A0&released=false`
const res: Res = await myFetch(url)
return res.data.map((k) => {
const url = `https://sspai.com/post/${k.id}`
return {
id: k.id,
title: k.title,
url,
}
})
})