From 2b59c835c4453f5749b678d68887f9dc4e25ff63 Mon Sep 17 00:00:00 2001 From: lyqluis <39592732+lyqluis@users.noreply.github.com> Date: Sun, 7 Apr 2024 16:35:07 +0800 Subject: [PATCH] fix(route): xueqiu user (#15140) --- lib/routes/xueqiu/user.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/routes/xueqiu/user.ts b/lib/routes/xueqiu/user.ts index c2d0f1110..105ff90ca 100644 --- a/lib/routes/xueqiu/user.ts +++ b/lib/routes/xueqiu/user.ts @@ -1,6 +1,7 @@ import { Route } from '@/types'; import cache from '@/utils/cache'; import got from '@/utils/got'; +import ofetch from '@/utils/ofetch'; import queryString from 'query-string'; import { parseDate } from '@/utils/parse-date'; import sanitizeHtml from 'sanitize-html'; @@ -47,11 +48,11 @@ async function handler(ctx) { 11: '交易', }; - const res1 = await got({ + const res1 = await ofetch.raw(rootUrl, { method: 'get', - url: rootUrl, }); - const token = res1.headers['set-cookie'].find((s) => s.startsWith('xq_a_token=')).split(';')[0]; + const cookieArray = res1.headers.getSetCookie(); + const token = cookieArray.find((c) => c.startsWith('xq_a_token=')); const res2 = await got({ method: 'get',