Environment
- CLI: xiaohongshu-cli 0.6.4 (installed via
uv tool install xiaohongshu-cli)
- Repo: jackwener/xiaohongshu-cli
- PyPI: 0.6.4 (no newer release available)
- OS: macOS 15.7.4
- Python: 3.11
Steps to Reproduce
xhs whoami --json → guest=false, cookie valid
xhs read <note_id> --json → ok=true, full note data returned
xhs comments <note_id> --json --xsec-token <token> → exit=1, api_error, code=-1
xhs comments <canonical_explore_url> --json --xsec-token <token> → same result
Expected Behavior
xhs comments should return comments for notes that are readable via xhs read.
Actual Behavior
{"ok": false, "error": {"code": "api_error", "message": "API error: {code: -1, success: false}"}}
Tested Scenarios
- Two different notes (both readable via
xhs read; note_id obfuscated)
- Both canonical explore URL and note_id forms
- With
--xsec-token (token verified working via xhs read)
- Environment without HTTP proxies
- Cookie valid (
xhs whoami --json → guest=false)
- All command output redacted — no token or sensitive value exposed
Root Cause Assessment
xhs read works, but xhs comments → get_comments() at xhs_cli/client_mixins.py:388
calls _main_api_get("/api/sns/web/v2/comment/page", ...) which returns code=-1.
Likely the comments API endpoint or its request parameters no longer match the current
xiaohongshu API behavior. The available evidence does not yet distinguish an upstream
API change from a CLI request-signing, header, or parameter compatibility issue.
Adjacent Issues (not same fault)
- #60: notifications endpoints return API
code=-1
- #62:
sub-comments is unavailable
Suggested Fix
- Investigate
get_comments() in xhs_cli/client_mixins.py (L388-442)
- Compare the
/api/sns/web/v2/comment/page request against the working xhs read API call
- Check if request signature, headers, or payload format has changed
Environment
uv tool install xiaohongshu-cli)Steps to Reproduce
xhs whoami --json→guest=false, cookie validxhs read <note_id> --json→ok=true, full note data returnedxhs comments <note_id> --json --xsec-token <token>→ exit=1,api_error,code=-1xhs comments <canonical_explore_url> --json --xsec-token <token>→ same resultExpected Behavior
xhs commentsshould return comments for notes that are readable viaxhs read.Actual Behavior
{"ok": false, "error": {"code": "api_error", "message": "API error: {code: -1, success: false}"}}Tested Scenarios
xhs read; note_id obfuscated)--xsec-token(token verified working viaxhs read)xhs whoami --json→guest=false)Root Cause Assessment
xhs readworks, butxhs comments→get_comments()atxhs_cli/client_mixins.py:388calls
_main_api_get("/api/sns/web/v2/comment/page", ...)which returnscode=-1.Likely the comments API endpoint or its request parameters no longer match the current
xiaohongshu API behavior. The available evidence does not yet distinguish an upstream
API change from a CLI request-signing, header, or parameter compatibility issue.
Adjacent Issues (not same fault)
code=-1sub-commentsis unavailableSuggested Fix
get_comments()inxhs_cli/client_mixins.py(L388-442)/api/sns/web/v2/comment/pagerequest against the workingxhs readAPI call