feat: support rednote.com via XHS_TARGET env var - #54
Open
murphykobe wants to merge 2 commits into
Open
Conversation
added 2 commits
May 8, 2026 20:52
rednote.com is the international re-skin of xiaohongshu.com — same backend (same IP, same xhs-pc-web app id, same /api/sns/web/v1 paths, same xhshow signing). It diverges only in host names and cookie domain. The existing code hardcoded `xiaohongshu.com` in seven places, so pointing the CLI at rednote required swapping a host triplet *and* a cookie-domain filter *and* a browser login URL. Centralize all target-specific strings into a `_Target` table in constants.py keyed by the `XHS_TARGET` env var (default `xiaohongshu`, no behavior change for existing users). Cookie/token-cache filenames are namespaced by target so the two sessions can coexist on disk. Verified end-to-end against `webapi.rednote.com`: - signed `/api/sns/web/v1/login/qrcode/create` returns HTTP 200 - browser cookie extraction → real profile via `/v2/user/me` - authenticated feed reads work Test suite: 114 passed under both `XHS_TARGET=xiaohongshu` (default) and `XHS_TARGET=rednote`.
Adds the env var to the Environment Variables table, a Targeting rednote.com subsection under Authentication, a Features bullet, and a Troubleshooting Q&A — mirrored in the Chinese sections.
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.
#36
rednote.com is the international re-skin of xiaohongshu.com — same backend (same IP, same xhs-pc-web app id, same /api/sns/web/v1 paths, same xhshow signing). It diverges only in host names and cookie domain. The existing code hardcoded
xiaohongshu.comin seven places, so pointing the CLI at rednote required swapping a host triplet and a cookie-domain filter and a browser login URL.Centralize all target-specific strings into a
_Targettable in constants.py keyed by theXHS_TARGETenv var (defaultxiaohongshu, no behavior change for existing users). Cookie/token-cache filenames are namespaced by target so the two sessions can coexist on disk.Verified end-to-end against
webapi.rednote.com:/api/sns/web/v1/login/qrcode/createreturns HTTP 200/v2/user/meXHS_TARGET=xiaohongshu(default) andXHS_TARGET=rednote.