Skip to content

fix(xiaohongshu): harden anti-detection flows#980

Merged
jackwener merged 1 commit intojackwener:mainfrom
Astro-Han:fix/xhs-anti-detection
Apr 13, 2026
Merged

fix(xiaohongshu): harden anti-detection flows#980
jackwener merged 1 commit intojackwener:mainfrom
Astro-Han:fix/xhs-anti-detection

Conversation

@Astro-Han
Copy link
Copy Markdown
Contributor

Description

Harden Xiaohongshu adapters against common risk-control triggers without changing the framework layer.

This PR:

  • disables redundant pre-navigation for the intended Xiaohongshu Strategy.COOKIE commands by setting navigateBefore: false
  • randomizes fixed waits and adds light pacing between creator-side requests
  • detects Xiaohongshu security-block pages in note, comments, and download, then throws CliError('SECURITY_BLOCK', ...) with actionable hints
  • replaces the fixed comments scroll pattern with condition-based scrolling
  • adds regression coverage for the new anti-detection behavior and manifest/runtime metadata

Related issue:

Historical context:

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, existing adapter changes only)
  • Updated docs/adapters/index.md table (N/A, no new adapter)
  • Updated sidebar in docs/.vitepress/config.mts (N/A, no new adapter)
  • Updated README.md / README.zh-CN.md when command discoverability changed (N/A, no discoverability change)
  • Used positional args for the command's primary subject unless a named flag is clearly better
  • Normalized expected adapter failures to CliError subclasses instead of raw Error

Screenshots / Output

$ npx tsc --noEmit
# exit 0

$ npm test
Test Files  196 passed (196)
Tests  1483 passed | 2 skipped (1485)

$ npm run build
✅ Manifest compiled: 550 entries

$ node dist/src/main.js validate
opencli validate: PASS
Checked 550 command(s)
Errors: 0  Warnings: 7

$ npx vitest run clis/xiaohongshu/navigation.test.js clis/xiaohongshu/note.test.js clis/xiaohongshu/comments.test.js clis/xiaohongshu/download.test.js clis/xiaohongshu/search.test.js clis/xiaohongshu/publish.test.js clis/xiaohongshu/creator-notes.test.js clis/xiaohongshu/creator-note-detail.test.js clis/xiaohongshu/creator-notes-summary.test.js
Test Files  9 passed (9)
Tests  76 passed (76)

Validation note:

  • opencli validate reports 7 warnings total. The Xiaohongshu warning on publish is pre-existing and not introduced by this PR.

@jackwener jackwener merged commit 83dce24 into jackwener:main Apr 13, 2026
11 checks passed
@Astro-Han Astro-Han deleted the fix/xhs-anti-detection branch April 13, 2026 10:18
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.

小红书opencli问题

2 participants