XiaoHongShu Comment
Overview
Use this skill to post exactly one random comment to XiaoHongShu in each run. Prefer dry-run first, then publish after confirming the selected post and comment text.
Prerequisites
python3mcporter(with a runningxiaohongshu-mcpserver)- XiaoHongShu account already logged in
Quick dependency check:
scripts/check_dependencies.sh
Quick Workflow
- Verify login:
mcporter call "xiaohongshu.check_login_status()"
- Run dry-run selection first:
scripts/random_home_comment.py --dry-run
- Publish one comment when preview looks good:
scripts/random_home_comment.py --comment "your comment"
- Verify result:
- Check CLI output for success, or inspect target feed manually.
Main Script
Use:
scripts/random_home_comment.py
Default behavior:
- Use
xiaohongshu.list_feeds()to fetch home recommendations. - Filter to commentable notes with
feed_id+xsec_token. - Pick one random post.
- Pick one random comment candidate.
- Post one comment via
xiaohongshu.post_comment_to_feed(...). - Save local history to
~/.agent-reach/xiaohongshu-mcp/comment_history.json. - Enforce a minimum interval of 30 minutes between comments.
- Skip previously-commented feed IDs unless explicitly allowed.
Recommended Commands
Dry run with fallback search keyword (useful when home feed capture fails):
scripts/random_home_comment.py --dry-run --fallback-search-keyword "AI"
Post one fixed comment:
scripts/random_home_comment.py --comment "Great perspective, thanks for sharing."
Use a comment pool file (one line per comment, # as comment line):
scripts/random_home_comment.py --comment-file ~/xhs_comments.txt
Exclude your own account by nickname:
scripts/random_home_comment.py --exclude-nickname "your-nickname"
Allow re-commenting old feed IDs and reduce interval:
scripts/random_home_comment.py --allow-repeat-feed --min-interval-minutes 5
Operational Rules
Apply these rules in every run:
- Post at most one comment per command execution.
- Run dry-run first unless the user clearly asks to post immediately.
- Keep comments human-like and context-relevant.
- Respect user-provided exclusions and interval settings.
- Stop and report if login is invalid or feed capture fails.
Troubleshooting
list_feeds() returns no data:
- Retry once.
- If still failing, run with
--fallback-search-keyword. - If needed, restart
xiaohongshu-mcpin non-headless mode and try again.
Not logged in:
- Run the login flow first (for example
xiaohongshu-login-darwin-arm64), then retry.
Comment rejected or failed:
- Retry with a shorter, safer comment.
- Switch to dry-run to inspect selected feed and input values.
Scripts
scripts/random_home_comment.py
- Randomly select and comment one post.
- Supports
--dry-run,--comment,--comment-file, exclusion filters, interval control, history, and optional search fallback.