Skip to content

fix(xiaohongshu): extract direct comment reply target - #2175

Open
aolast wants to merge 1 commit into
jackwener:mainfrom
aolast:fix/xiaohongshu-comment-reply-to
Open

fix(xiaohongshu): extract direct comment reply target#2175
aolast wants to merge 1 commit into
jackwener:mainfrom
aolast:fix/xiaohongshu-comment-reply-to

Conversation

@aolast

@aolast aolast commented Jul 24, 2026

Copy link
Copy Markdown

Description

Fixes comments --with-replies reporting the top-level thread author as reply_to for every nested Xiaohongshu/Rednote reply.

The extractor previously hard-coded the enclosing top-level author for all nested rows. Xiaohongshu's rendered DOM distinguishes the two cases:

  • a direct reply to the top-level comment has no explicit target marker, so it falls back to the thread-root author;
  • a reply to another nested comment renders the direct target as .content > .nickname, which is now extracted into reply_to.

The page exposes the target display name but no target profile link or user ID, so this change does not invent an ID. Rednote reuses the same extractor and receives the same fix.

This PR also:

  • adds JSDOM regression coverage for direct replies, reply-to-reply rows, and exact restoration of temporary DOM globals;
  • closes each temporary JSDOM window after extraction;
  • clarifies the --with-replies help text and adapter documentation;
  • regenerates cli-manifest.json.

Related issue: Fixes #2174

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • 🌐 New site adapter
  • 📝 Documentation
  • ♻️ Refactor
  • 🔧 CI / build / tooling

Checklist

  • I ran the checks relevant to this PR
  • I updated tests or docs if needed
  • I included output or screenshots when useful

Documentation (if adding/modifying an adapter)

  • Added doc page under docs/adapters/ (N/A — both adapters already have pages)
  • Updated docs/adapters/index.md table (N/A — no adapter or command was added)
  • Updated sidebar in docs/.vitepress/config.mts (N/A — no page was added)
  • Updated README.md / README.zh-CN.md when command discoverability changed (N/A — command surface is unchanged)
  • Used positional args for the command's primary subject unless a named flag is clearly better (no argument-shape change)
  • Normalized expected adapter failures to CliError subclasses instead of raw Error (no error-path change)

Screenshots / Output

Live validation against a signed Xiaohongshu note URL through OpenCLI Browser Bridge:

returned rows: 98
rows with an explicit `回复 <author>:` target: 23
rows where the displayed target differs from `reply_to`: 0

The signed URL and xsec_token are intentionally omitted.

Validation:

npm test
  Test Files  559 passed (559)
  Tests       6350 passed | 1 skipped (6351)

npx tsc --noEmit                    PASS
npm run build                       PASS
npm run docs:build                  PASS
npm run check:silent-column-drop    PASS (new=0)
npm run check:typed-error-lint      PASS (new=0)
opencli validate                    PASS (1301 commands, 0 errors)

@aolast
aolast force-pushed the fix/xiaohongshu-comment-reply-to branch from d8bde5a to 131c6ee Compare July 24, 2026 02:18
@aolast
aolast marked this pull request as ready for review July 24, 2026 02:50
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.

[Bug]: xiaohongshu comments assigns thread-root author to reply_to for nested replies

1 participant