Skip to content

Commit

Permalink
fix(route): Correctly obtain d_c0 from response from Zhihu Zhuanlan (
Browse files Browse the repository at this point in the history
…#16161)

* fix(route): Correctly obtain `d_c0` from response from Zhihu Zhuanlan

* Update utils.ts
  • Loading branch information
dzx-dzx authored Jul 14, 2024
1 parent 55c6f85 commit 0479f54
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/routes/zhihu/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +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 zseCk = response1._data.match(/var e="__zse_ck",t=\(typeof __g\.ck == 'string' && __g\.ck\)\|\|"([\w+/=]*?)",_=6048e5;/)[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, {
Expand Down

0 comments on commit 0479f54

Please sign in to comment.