From 681d137975253516d79ac4fe31521fcf9d4b25ea Mon Sep 17 00:00:00 2001 From: chenxuan <77540051+chenxuan520@users.noreply.github.com> Date: Wed, 6 Aug 2025 19:56:39 +0800 Subject: [PATCH] fix: Using the hupu official API (#203) --- server/sources/hupu.ts | 49 ++++++++++++++++++++++++++++-------------- 1 file changed, 33 insertions(+), 16 deletions(-) diff --git a/server/sources/hupu.ts b/server/sources/hupu.ts index 87445d5..c5e66ed 100644 --- a/server/sources/hupu.ts +++ b/server/sources/hupu.ts @@ -1,20 +1,37 @@ -interface Res { - data: { - title: string - hot: string - url: string - mobil_url: string - }[] +interface HotItem { + id: string + title: string + url: string + mobileUrl: string } export default defineSource(async () => { - const r: Res = await myFetch(`https://api.vvhan.com/api/hotlist/huPu`) - return r.data.map((k) => { - return { - id: k.url, - title: k.title, - url: k.url, - mobileUrl: k.mobil_url, - } - }) + // 获取虎扑新热榜页面的HTML内容 + const html = await myFetch(`https://bbs.hupu.com/topic-daily-hot`) + + // 正则表达式匹配新的热榜项结构 + const regex = /