97 lines
3.4 KiB
Markdown
97 lines
3.4 KiB
Markdown
---
|
|
name: xiaohongshu-engage
|
|
description: "Browse XiaoHongShu (小红书) with Playwright and execute account interactions end-to-end: discover content, open notes, like, favorite, and post concise comments. Use when the user asks to '逛逛', browse feed content, or delegate 点赞/收藏/评论 on their logged-in account."
|
|
---
|
|
|
|
# Xiaohongshu Engage
|
|
|
|
## Workflow
|
|
|
|
1. Confirm login state before interacting.
|
|
2. Navigate to discovery feed and identify relevant content.
|
|
3. Open note details and perform requested engagement actions.
|
|
4. Validate action success from UI state.
|
|
5. Summarize exactly what was done.
|
|
|
|
## Shared Session Policy
|
|
|
|
- Use per-thread Playwright CLI sessions across all web-automation skills:
|
|
- Auto session policy: `tools/pw` derives one Playwright session per `CODEX_THREAD_ID` (fallback: `PLAYWRIGHT_SESSION_OWNER` or explicit `--session`).
|
|
- Use `/Users/xd/java/xhs/tools/pw` as the only Playwright CLI entrypoint.
|
|
- Prefer the default auto session; pass `--session <name>` only when explicit isolation is required.
|
|
|
|
## Network Preflight Gate (Required)
|
|
|
|
- Before first browser step, run:
|
|
- `tools/pw --help`
|
|
- If it fails with network sandbox signatures (`ENOTFOUND`, `EAI_AGAIN`, `ETIMEDOUT`, `ECONNREFUSED`, or `registry.npmjs.org` fetch failure):
|
|
- rerun the same command with escalation (`sandbox_permissions=require_escalated`).
|
|
- Do not continue browsing/点赞/收藏/评论 until this preflight succeeds.
|
|
|
|
## 1) Confirm Login State
|
|
|
|
- Snapshot current page.
|
|
- Check that the sidebar includes the `我` entry and that profile link is accessible.
|
|
- If not logged in, stop and ask the user to complete login first.
|
|
|
|
## 2) Enter Feed And Pick Topics
|
|
|
|
- Click `发现`.
|
|
- Prefer topics related to user context or explicit interest (for example AI, coding, photography, travel).
|
|
- Open one note at a time from the card list.
|
|
|
|
## 3) Engage On A Note
|
|
|
|
For each selected note:
|
|
|
|
- Click `点赞`.
|
|
- Click `收藏`.
|
|
- Enter a concise comment and submit.
|
|
- Keep comments specific to note content, short, and polite.
|
|
|
|
Comment style:
|
|
|
|
- 1 sentence, <= 35 Chinese characters preferred.
|
|
- Avoid arguments, sarcasm, or sensitive claims.
|
|
- Prefer useful and neutral phrasing.
|
|
|
|
Examples:
|
|
|
|
- `这个思路很实用,感谢分享。`
|
|
- `观点很清晰,落地建议也很有帮助。`
|
|
- `内容很有启发,我也在实践类似方法。`
|
|
|
|
## 4) Verify Success Signals
|
|
|
|
After each action, verify at least one visible signal:
|
|
|
|
- Like count increases or icon state toggles.
|
|
- `收藏成功` toast appears or favorite count changes.
|
|
- `评论成功` toast appears and new comment is present in comment list.
|
|
|
|
If a send/click fails because overlay intercepts:
|
|
|
|
- Re-snapshot.
|
|
- Wait briefly and retry.
|
|
- Use keyboard `Enter` submission as fallback for comment sending.
|
|
|
|
## 5) Handle UI Reliability
|
|
|
|
- Re-snapshot after navigation, modal open/close, and any major DOM change.
|
|
- Treat stale refs as expected behavior; refresh refs before retrying.
|
|
- Close note modal before opening another card when interactions become blocked.
|
|
|
|
## 6) Report Back To User
|
|
|
|
Return a compact action log:
|
|
|
|
- Which notes were engaged.
|
|
- How many likes, favorites, and comments were completed.
|
|
- Any failures or skipped items.
|
|
|
|
## Boundaries
|
|
|
|
- Do not follow users, send private messages, or change profile/account settings unless explicitly requested.
|
|
- Do not post repeated or spammy comments across multiple notes.
|
|
- Stop and notify user if login state is lost or account safety prompts appear.
|