diff --git a/src/routes/huxiu.ts b/src/routes/huxiu.ts old mode 100644 new mode 100755 index 7a04b32..8906d13 --- a/src/routes/huxiu.ts +++ b/src/routes/huxiu.ts @@ -16,36 +16,57 @@ export const handleRoute = async (_: undefined, noCache: boolean) => { return routeData; }; -// 标题处理 -const titleProcessing = (text: string) => { - const paragraphs = text.split("

"); - const title = paragraphs.shift()?.replace(/。$/, ""); - const intro = paragraphs.join("

"); - return { title, intro }; -}; - const getList = async (noCache: boolean) => { - const url = `https://www.huxiu.com/moment/`; + // 使用移动端页面,数据通过 window.__NUXT__ 内联 + const url = `https://m.huxiu.com/moment/`; const result = await get({ url, noCache, + headers: { + "User-Agent": + "Mozilla/5.0 (iPhone; CPU iPhone OS 15_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.0 Mobile/15E148 Safari/604.1", + Referer: "https://m.huxiu.com/moment/", + }, + responseType: "text", }); - // 正则查找 - const pattern = - /