Skip to content

fix: propagate xsec token for sub-comments - #81

Open
RuochenLyu wants to merge 1 commit into
jackwener:mainfrom
RuochenLyu:agent/fix-sub-comments-xsec-token
Open

fix: propagate xsec token for sub-comments#81
RuochenLyu wants to merge 1 commit into
jackwener:mainfrom
RuochenLyu:agent/fix-sub-comments-xsec-token

Conversation

@RuochenLyu

Copy link
Copy Markdown

Summary

  • add an optional --xsec-token flag to xhs sub-comments
  • forward the token to get_sub_comments
  • include the browser query parameters image_formats, top_comment_id, and xsec_token
  • cover both the client request parameters and CLI argument propagation with unit tests

Root cause

The sub-comment endpoint only sent note_id, root_comment_id, num, and cursor. The current web request also includes the note's xsec_token and stable image/top-comment parameters. Without the token, accessible reply threads can be misclassified as verification failures.

The new argument is optional and appended to the Python method signature, so existing API and CLI calls remain compatible.

Example using synthetic values:

xhs sub-comments note-123 comment-456 --xsec-token synthetic-token --json

Tests

  • uv run ruff check .
  • uv run python -m pytest -q --ignore=tests/test_integration.py (116 passed, 11 deselected)
  • uv build

Related to #14.

@RuochenLyu
RuochenLyu marked this pull request as ready for review August 5, 2026 14:19
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