Problem
International Xiaohongshu accounts now land on rednote.com instead of www.xiaohongshu.com — the site 302-redirects non-mainland users to the rednote domain. As a result, every opencli xiaohongshu * subcommand fails with AUTH_REQUIRED, because the adapter is hardcoded to www.xiaohongshu.com and cookies live under a different root domain.
Users in this situation are fully logged in on rednote.com but have no way to reach the adapter.
Investigation
Spent some time comparing the two frontends via opencli browser. The short version: rednote.com is the same codebase with a different domain — backend APIs mirror xiaohongshu.com 1:1.
Identical
- DOM selectors used by the adapter:
section.note-item, a.cover, #search-input, #detail-desc, #detail-title, .note-content, .username, .comment-item, .comment-item .content
- URL paths:
/search_result?keyword=..., /search_result/{id}?xsec_token=..., /explore/{id}?xsec_token=...
- API paths:
/api/sns/web/v1/search/notes, /api/sns/web/v2/user/me, /api/sns/web/unread_count, /api/sns/web/v1/search/filter, …
- Response schema (
data.items[].note_card.*, xsec_token, etc.)
- Core cookies:
a1, xsecappid, webId
xsec_token auth mechanism
Different (only the hostnames)
|
xiaohongshu |
rednote |
| Web host |
www.xiaohongshu.com |
www.rednote.com |
| API host |
edith.xiaohongshu.com |
webapi.rednote.com |
| Security/signing host |
fe-static.xhscdn.com |
as.rednote.com |
| Cookie root |
.xiaohongshu.com |
.rednote.com |
| Login gate |
登录后查看搜索结果 inline text |
Full-screen login modal |
web_session cookie |
present |
absent (different session mechanism; still authenticates) |
Possible directions
Listing options — happy to go with whichever the maintainers prefer:
- Domain routing inside the existing
xiaohongshu adapter — pick host pair based on cookie presence or an env flag. Minimal new code, but touches currently-stabilizing xhs files.
- Separate
clis/rednote/ adapter — zero impact on xhs, at the cost of near-duplicate code for selectors/API paths.
- Extract
_shared/xhs-core and have both xiaohongshu and rednote adapters declare only their domain triple. Cleanest but largest refactor.
My lean is (2) for safety given the active xhs bugfix traffic in the last few weeks (#980, #996, #1050, #1060), but I don't want to block on that — happy to follow whichever direction you'd like.
Notes
- Also need to handle the login-gate detection change (modal instead of inline text) for the
WAIT_FOR_CONTENT_JS branch in search.js.
download.js uses page.getCookies({ domain: 'xiaohongshu.com' }); rednote flow would need 'rednote.com'.
creator.xiaohongshu.com (publish / creator-*) may not have a rednote counterpart; those can be left xhs-only initially.
Willing to submit the PR once you pick a direction.
Problem
International Xiaohongshu accounts now land on
rednote.cominstead ofwww.xiaohongshu.com— the site 302-redirects non-mainland users to the rednote domain. As a result, everyopencli xiaohongshu *subcommand fails withAUTH_REQUIRED, because the adapter is hardcoded towww.xiaohongshu.comand cookies live under a different root domain.Users in this situation are fully logged in on
rednote.combut have no way to reach the adapter.Investigation
Spent some time comparing the two frontends via
opencli browser. The short version: rednote.com is the same codebase with a different domain — backend APIs mirror xiaohongshu.com 1:1.Identical
section.note-item,a.cover,#search-input,#detail-desc,#detail-title,.note-content,.username,.comment-item,.comment-item .content/search_result?keyword=...,/search_result/{id}?xsec_token=...,/explore/{id}?xsec_token=.../api/sns/web/v1/search/notes,/api/sns/web/v2/user/me,/api/sns/web/unread_count,/api/sns/web/v1/search/filter, …data.items[].note_card.*,xsec_token, etc.)a1,xsecappid,webIdxsec_tokenauth mechanismDifferent (only the hostnames)
www.xiaohongshu.comwww.rednote.comedith.xiaohongshu.comwebapi.rednote.comfe-static.xhscdn.comas.rednote.com.xiaohongshu.com.rednote.com登录后查看搜索结果inline textweb_sessioncookiePossible directions
Listing options — happy to go with whichever the maintainers prefer:
xiaohongshuadapter — pick host pair based on cookie presence or an env flag. Minimal new code, but touches currently-stabilizing xhs files.clis/rednote/adapter — zero impact on xhs, at the cost of near-duplicate code for selectors/API paths._shared/xhs-coreand have bothxiaohongshuandrednoteadapters declare only their domain triple. Cleanest but largest refactor.My lean is (2) for safety given the active xhs bugfix traffic in the last few weeks (#980, #996, #1050, #1060), but I don't want to block on that — happy to follow whichever direction you'd like.
Notes
WAIT_FOR_CONTENT_JSbranch insearch.js.download.jsusespage.getCookies({ domain: 'xiaohongshu.com' }); rednote flow would need'rednote.com'.creator.xiaohongshu.com(publish / creator-*) may not have a rednote counterpart; those can be left xhs-only initially.Willing to submit the PR once you pick a direction.