diff --git a/server/glob.d.ts b/server/glob.d.ts index 5e4ba07..a0c8cde 100644 --- a/server/glob.d.ts +++ b/server/glob.d.ts @@ -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') diff --git a/server/sources/juejin.ts b/server/sources/juejin.ts new file mode 100644 index 0000000..a6a05e5 --- /dev/null +++ b/server/sources/juejin.ts @@ -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, + } + }) +}) diff --git a/server/sources/nowcoder.ts b/server/sources/nowcoder.ts index a131d7a..01d7956 100644 --- a/server/sources/nowcoder.ts +++ b/server/sources/nowcoder.ts @@ -5,8 +5,7 @@ interface Res { title: string type: number uuid: string - hotValueFromDolphin: number - } + }[] } } diff --git a/server/sources/sspai.ts b/server/sources/sspai.ts new file mode 100644 index 0000000..4968cf6 --- /dev/null +++ b/server/sources/sspai.ts @@ -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, + } + }) +}) diff --git a/shared/pinyin.json b/shared/pinyin.json index b85ff68..8a65106 100644 --- a/shared/pinyin.json +++ b/shared/pinyin.json @@ -39,5 +39,7 @@ "linuxdo-hot": "LINUX DO-jinrizuire", "ghxi": "guoheboke", "smzdm": "shenmezhidemai", - "nowcoder": "niuke" + "nowcoder": "niuke", + "sspai": "shaoshupai", + "juejin": "xitujuejin" } \ No newline at end of file diff --git a/shared/pre-sources.ts b/shared/pre-sources.ts index 6aff6a9..3902e83 100644 --- a/shared/pre-sources.ts +++ b/shared/pre-sources.ts @@ -357,6 +357,20 @@ export const originSources = { type: "hottest", home: "https://www.nowcoder.com", }, + "sspai": { + name: "少数派", + column: "china", + color: "red", + type: "hottest", + home: "https://sspai.com", + }, + "juejin": { + name: "稀土掘金", + column: "china", + color: "blue", + type: "hottest", + home: "https://juejin.cn", + }, } as const satisfies Record export function genSources() { diff --git a/shared/sources.json b/shared/sources.json index 84cb40c..5089f87 100644 --- a/shared/sources.json +++ b/shared/sources.json @@ -348,6 +348,7 @@ "bilibili-hot-video": { "name": "哔哩哔哩", "type": "hottest", + "disable": "cf", "column": "china", "home": "https://www.bilibili.com", "color": "blue", @@ -357,6 +358,7 @@ "bilibili-ranking": { "name": "哔哩哔哩", "type": "hottest", + "disable": "cf", "column": "china", "home": "https://www.bilibili.com", "color": "blue", @@ -448,5 +450,21 @@ "home": "https://www.nowcoder.com", "color": "blue", "interval": 600000 + }, + "sspai": { + "name": "少数派", + "type": "hottest", + "column": "china", + "home": "https://sspai.com", + "color": "red", + "interval": 600000 + }, + "juejin": { + "name": "稀土掘金", + "type": "hottest", + "column": "china", + "home": "https://juejin.cn", + "color": "blue", + "interval": 600000 } } \ No newline at end of file