diff --git a/server/sources/cls/index.ts b/server/sources/cls/index.ts index 5a09599..5c5e04a 100644 --- a/server/sources/cls/index.ts +++ b/server/sources/cls/index.ts @@ -23,40 +23,52 @@ interface Depthes { } } -// 失效 +interface Hot { + data: Item[] +} + const depth = defineSource(async () => { const apiUrl = `https://www.cls.cn/v3/depth/home/assembled/1000` const res: Depthes = await myFetch(apiUrl, { - query: await getSearchParams(), + query: Object.fromEntries(await getSearchParams()), }) return res.data.depth_list.sort((m, n) => n.ctime - m.ctime).map((k) => { return { id: k.id, title: k.title || k.brief, mobileUrl: k.shareurl, - extra: { - date: k.ctime * 1000, - }, + pubDate: k.ctime * 1000, + url: `https://www.cls.cn/detail/${k.id}`, + } + }) +}) + +const hot = defineSource(async () => { + const apiUrl = `https://www.cls.cn/v2/article/hot/list` + const res: Hot = await myFetch(apiUrl, { + query: Object.fromEntries(await getSearchParams()), + }) + return res.data.map((k) => { + return { + id: k.id, + title: k.title || k.brief, + mobileUrl: k.shareurl, url: `https://www.cls.cn/detail/${k.id}`, } }) }) -// hot 失效 const telegraph = defineSource(async () => { const apiUrl = `https://www.cls.cn/nodeapi/updateTelegraphList` const res: TelegraphRes = await myFetch(apiUrl, { - query: await getSearchParams({ }), - timeout: 10000, + query: Object.fromEntries(await getSearchParams()), }) return res.data.roll_data.filter(k => !k.is_ad).map((k) => { return { id: k.id, title: k.title || k.brief, mobileUrl: k.shareurl, - extra: { - date: k.ctime * 1000, - }, + pubDate: k.ctime * 1000, url: `https://www.cls.cn/detail/${k.id}`, } }) @@ -66,4 +78,5 @@ export default defineSource({ "cls": telegraph, "cls-telegraph": telegraph, "cls-depth": depth, + "cls-hot": hot, }) diff --git a/shared/pinyin.json b/shared/pinyin.json index 411fb96..5683474 100644 --- a/shared/pinyin.json +++ b/shared/pinyin.json @@ -14,7 +14,8 @@ "thepaper": "pengpaixinwen-rebang", "cankaoxiaoxi": "cankaoxiaoxi", "cls-telegraph": "cailianshe-dianbao", - "cls-depth": "cailianshe-shendutoutiao", + "cls-depth": "cailianshe-shendu", + "cls-hot": "cailianshe-remen", "xueqiu-hotstock": "xueqiu-remengupiao", "gelonghui": "gelonghui-shijian", "fastbull-express": "fabucaijing-kuaixun", diff --git a/shared/sources.ts b/shared/sources.ts index 8393a81..d32d5dd 100644 --- a/shared/sources.ts +++ b/shared/sources.ts @@ -159,10 +159,11 @@ export const originSources = { type: "realtime", }, depth: { - title: "深度头条", - // invalid, not way to get - disable: true, - interval: Time.Common, + title: "深度", + }, + hot: { + title: "热门", + type: "hottest", }, }, },