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 depth = defineSource(async () => {
const apiUrl = `https://www.cls.cn/v3/depth/home/assembled/1000` const apiUrl = `https://www.cls.cn/v3/depth/home/assembled/1000`
const res: Depthes = await myFetch(apiUrl, { 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 res.data.depth_list.sort((m, n) => n.ctime - m.ctime).map((k) => {
return { return {
id: k.id, id: k.id,
title: k.title || k.brief, title: k.title || k.brief,
mobileUrl: k.shareurl, mobileUrl: k.shareurl,
extra: { pubDate: k.ctime * 1000,
date: 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}`, url: `https://www.cls.cn/detail/${k.id}`,
} }
}) })
}) })
// hot 失效
const telegraph = defineSource(async () => { const telegraph = defineSource(async () => {
const apiUrl = `https://www.cls.cn/nodeapi/updateTelegraphList` const apiUrl = `https://www.cls.cn/nodeapi/updateTelegraphList`
const res: TelegraphRes = await myFetch(apiUrl, { const res: TelegraphRes = await myFetch(apiUrl, {
query: await getSearchParams({ }), query: Object.fromEntries(await getSearchParams()),
timeout: 10000,
}) })
return res.data.roll_data.filter(k => !k.is_ad).map((k) => { return res.data.roll_data.filter(k => !k.is_ad).map((k) => {
return { return {
id: k.id, id: k.id,
title: k.title || k.brief, title: k.title || k.brief,
mobileUrl: k.shareurl, mobileUrl: k.shareurl,
extra: { pubDate: k.ctime * 1000,
date: k.ctime * 1000,
},
url: `https://www.cls.cn/detail/${k.id}`, url: `https://www.cls.cn/detail/${k.id}`,
} }
}) })
@ -66,4 +78,5 @@ export default defineSource({
"cls": telegraph, "cls": telegraph,
"cls-telegraph": telegraph, "cls-telegraph": telegraph,
"cls-depth": depth, "cls-depth": depth,
"cls-hot": hot,
}) })

View File

@ -14,7 +14,8 @@
"thepaper": "pengpaixinwen-rebang", "thepaper": "pengpaixinwen-rebang",
"cankaoxiaoxi": "cankaoxiaoxi", "cankaoxiaoxi": "cankaoxiaoxi",
"cls-telegraph": "cailianshe-dianbao", "cls-telegraph": "cailianshe-dianbao",
"cls-depth": "cailianshe-shendutoutiao", "cls-depth": "cailianshe-shendu",
"cls-hot": "cailianshe-remen",
"xueqiu-hotstock": "xueqiu-remengupiao", "xueqiu-hotstock": "xueqiu-remengupiao",
"gelonghui": "gelonghui-shijian", "gelonghui": "gelonghui-shijian",
"fastbull-express": "fabucaijing-kuaixun", "fastbull-express": "fabucaijing-kuaixun",

View File

@ -159,10 +159,11 @@ export const originSources = {
type: "realtime", type: "realtime",
}, },
depth: { depth: {
title: "深度头条", title: "深度",
// invalid, not way to get },
disable: true, hot: {
interval: Time.Common, title: "热门",
type: "hottest",
}, },
}, },
}, },