Skip to content

feat: support rednote.com via XHS_TARGET env var - #54

Open
murphykobe wants to merge 2 commits into
jackwener:mainfrom
murphykobe:feat/rednote-target-support
Open

feat: support rednote.com via XHS_TARGET env var#54
murphykobe wants to merge 2 commits into
jackwener:mainfrom
murphykobe:feat/rednote-target-support

Conversation

@murphykobe

Copy link
Copy Markdown

#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.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.

Murphy Liu 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant