fix(route/zhihu): Extract `__zse_ck` in a new way. (#16137)

* fix(route/zhihu): Extract `__zse_ck` in a new way.

* Update utils.ts
This commit is contained in:
Andvari 2024-07-10 20:25:04 +08:00 committed by GitHub
parent fc081d0f26
commit 0152cfefde
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 4 deletions

View File

@ -63,10 +63,7 @@ export const getSignedHeader = async (url: string, apiPath: string) => {
// fisrt: get cookie(dc_0) from zhihu.com
const dc0 = await cache.tryGet('zhihu:cookies:d_c0', async () => {
const response1 = await ofetch.raw(url);
const $ = load(response1._data);
const zseCk = $('script:contains("__zse_ck")')
.text()
.match(/\|\|"(.*?)",.*;document\.cookie/)?.[1];
const zseCk = response1._data.match(/var e="__zse_ck",t=\(typeof __g\.ck == 'string' && __g\.ck\)\|\|"([\w+/=]*?)",_=6048e5;/)[1];
const response2 = zseCk
? await ofetch.raw(url, {