fix(route): xueqiu user (#15140)

This commit is contained in:
lyqluis 2024-04-07 16:35:07 +08:00 committed by GitHub
parent cb69f5032c
commit 2b59c835c4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 3 deletions

View File

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