fix(source): cls-depth and cls-hot

This commit is contained in:
Ou 2024-11-22 00:45:32 +08:00
parent 06d7e3b23c
commit fb1fe98866
3 changed files with 31 additions and 16 deletions

View File

@ -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,
})

View File

@ -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",

View File

@ -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",
},
},
},