fix(route/zhihu): auto-fetch __zse_ck when absent from ZHIHU_COOKIES#21321
Merged
TonyRL merged 1 commit intoDIYgod:masterfrom Mar 7, 2026
Merged
fix(route/zhihu): auto-fetch __zse_ck when absent from ZHIHU_COOKIES#21321TonyRL merged 1 commit intoDIYgod:masterfrom
__zse_ck when absent from ZHIHU_COOKIES#21321TonyRL merged 1 commit intoDIYgod:masterfrom
Conversation
When ZHIHU_COOKIES is configured without __zse_ck, automatically fetch the value from Zhihu's public static JS (static.zhihu.com/zse-ck/v3.js). __zse_ck is a site-wide token (not user-specific) that Zhihu embeds in a static JS file and rotates periodically. When it expires, routes that scrape HTML pages (e.g. /zhihu/posts/people/:id) return 403, while API-only routes are unaffected. Users can now omit __zse_ck from ZHIHU_COOKIES and it will be fetched and cached automatically, eliminating manual cookie rotation for this token. Existing configs that include __zse_ck are unchanged.
Contributor
Auto ReviewNo clear rule violations found in the current diff. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Involved Issue / 该 PR 相关 Issue
Close #
Example for the Proposed Route(s) / 路由地址示例
New RSS Route Checklist / 新 RSS 路由检查表
Note / 说明
When
ZHIHU_COOKIESis configured, theifbranch ingetSignedHeadersends the full cookie string as-is, including a potentially stale__zse_ck. This token is embedded in Zhihu's static JS (static.zhihu.com/zse-ck/v3.js) and rotates periodically. When it expires, routes that scrape HTML pages (e.g./zhihu/posts/people/:id) return 403, while API-only routes (e.g./zhihu/people/answers/:id) are unaffected because they only rely on the dynamically computedx-zse-96header.This PR adds a fallback: if
__zse_ckis absent fromZHIHU_COOKIES, fetch it automatically from Zhihu's public static JS. The value is site-wide (not user-specific) and requires no login. Users can now omit__zse_ckfromZHIHU_COOKIESand it will be fetched and cached automatically. Existing configs that include__zse_ckare unchanged.