8.2 KiB
8.2 KiB
name, description
| name | description |
|---|---|
| xiaohongshu-publish-video | Execute XiaoHongShu (小红书) video-note publishing workflow in the creator platform: open publish center, switch to 视频 mode, prepare video assets, upload videos, fill title/body/topics, configure settings, and validate pre-publish state. Use when the user asks to 发布视频笔记, 发视频, or automate web publishing steps before final submit. Prefer user-provided video paths; if no video paths are provided, generate videos via gemini-video-web and consume manifest target paths for upload. Support configurable publish modes (`safe_mode` and `live_mode`). |
Xiaohongshu Publish Video
Workflow
- Confirm account is logged in and creator center is reachable.
- Open creator publish page and switch to 视频 publishing mode.
- Prepare video inputs: use user-provided paths first, otherwise generate via gemini-video-web.
- Upload video and wait for editor panel readiness.
- Fill title/body/topics and required settings.
- Validate preview and publish controls.
- Execute publish behavior according to publish mode.
- Save publish evidence and return summary.
Shared Session Policy
- Use per-thread Playwright CLI sessions across all web-automation skills:
- Auto session policy:
tools/pwderives one Playwright session perCODEX_THREAD_ID(fallback:PLAYWRIGHT_SESSION_OWNERor explicit--session).
- Auto session policy:
- Use
/Users/xd/java/xhs/tools/pwas the only Playwright CLI entrypoint. - Prefer the default auto session; pass
--session <name>only when explicit isolation is required.
1) Enter Creator Publish Page
- From web homepage, click left sidebar
发布. - Expect new tab:
https://creator.xiaohongshu.com/publish/publish?.... - Switch to the new tab before continuing.
2) Switch To 视频 Mode
- Click
上传视频tab (or equivalent video publish tab text). - If tab click fails due viewport/position issues:
- Resize viewport to desktop (for example 1440x1000).
- Re-snapshot and retry with latest refs.
- Use
上传视频area visibility as the final switch-success signal. - Do not treat tab text click success as completion by itself.
3) Prepare Videos
- Prefer user-provided absolute file paths when available.
- If user did not provide video paths:
- Generate videos from topic/content using
gemini-video-web. - Read the generated manifest JSON and extract
files[*].target_path. - Use manifest-derived paths as upload input.
- Generate videos from topic/content using
- Ensure at least 1 valid video path exists before entering upload.
Manifest linkage rules:
- Trust manifest
status=okandcollected_count>=1before upload. - If manifest status is not ok, stop and return video-preparation failure.
- Avoid guessing latest files by timestamp when manifest is available.
4) Upload Video
- Click
上传视频to open file chooser. - Upload absolute file paths from Step 3.
- After upload, verify editor state:
- video preview area is visible
- title and body input areas are visible
- upload progress indicator is complete
Video readiness rule:
- Wait until transcoding/upload state is done before publish checks.
- If status stays processing beyond timeout, retry snapshot and wait once.
- If still processing, block final publish.
5) Fill Core Content
- Fill title textbox (
填写标题会有更多赞哦or equivalent). - Fill body contenteditable area.
- Insert topics (mandatory):
- Click recommended topic chips, and/or
- Use
话题button for manual insertion. - Validate final topic count from actual editor content, not click count.
- Ensure total topic count is >= 5 before proceeding.
- Verify body counter and preview panel update.
Topic counting rule:
- Count inserted topic tokens in正文内容(例如
#话题)。 - If token count < 5, continue inserting until count >= 5.
- If repeated insertion still fails to reach 5, block final publish.
Title/body rule:
- Title must be non-empty and specific to the video content.
- Body must be non-empty and descriptive (recommended >= 20 Chinese characters).
- If either title or body is empty, block final publish.
6) Configure Settings
- Do not add location.
- Review content settings:
原创声明公开可见定时发布- other toggles as needed by request.
- Ignore geolocation prompts/errors and keep location empty.
Video-specific checks:
- If cover selection is available, confirm a cover is selected.
- If music/subtitle/licensing controls appear, keep defaults unless user explicitly requests changes.
7) Validate Pre-Publish State
- Confirm right-side preview reflects title/body/topics.
- Confirm title is non-empty.
- Confirm body is non-empty (recommended >= 20 Chinese characters).
- Confirm topic count is >= 5.
- Confirm no location tag is present in preview.
- Confirm uploaded video count is >= 1.
- Confirm video is ready (no active processing indicator).
- Confirm bottom actions are visible:
暂存离开发布
- Publish hard gate (must all pass):
- title is non-empty
- body is non-empty (recommended >= 20 Chinese characters)
- video count >= 1
- topic count >= 5
- location is empty
- video ready state is true
- Default safety behavior:
- Do not click final
发布unless user explicitly asks for real submission now.
- Do not click final
8) Publish Mode
safe_mode(default):- Run full workflow and hard-gate checks.
- Never click final
发布.
live_mode:- Require explicit user intent for real posting in current turn.
- Click final
发布only after hard-gate checks pass.
9) Failure Handling (Layered Retries)
- Video preparation failure:
- If user paths are invalid, ask for corrected absolute paths.
- If gemini generation fails, stop publish flow and return failure reason.
- Manifest linkage failure:
- If manifest missing/invalid/empty, retry reading once.
- If still invalid, stop and return manifest failure.
- Upload failure:
- If upload area blocks or file chooser fails, re-snapshot and retry once.
- If still failing, stop and report upload failure.
- Video processing timeout:
- Retry waiting once with refreshed snapshot.
- If still not ready, block final publish.
- Content validation failure:
- If title/body is empty, refill once and re-check.
- If still empty, block final publish.
- Topic insertion failure:
- Retry insertion via alternate path (chip -> manual topic button).
- If topic count stays < 5, block final publish.
- UI interaction failure:
- On stale refs/click interception/modal cover, wait briefly, re-snapshot, retry once.
- Publish action failure:
- If publish click fails, re-snapshot and retry click once.
- If success page still not reached, return publish-step failure.
- Publish gate failure:
- If any hard gate fails, do not click
发布; return blocking conditions.
- If any hard gate fails, do not click
10) Reliability Rules
- Re-snapshot after:
- tab switches
- upload completion
- dropdown/modal open/close
- On click interception or stale refs:
- wait briefly
- refresh snapshot
- retry with updated refs.
11) Save Publish Evidence
- On successful live publish:
- Wait for success indicator (for example
发布成功). - Capture success screenshot to:
/Users/xd/java/xhs/output/playwright/xhs-video-publish-success-<YYYYMMDD-HHMMSS>.png
- Record:
- publish time
- title
- uploaded video path list
- screenshot path
- Wait for success indicator (for example
12) Return Report
Return a compact execution summary:
- uploaded videos count
- title/body/topic/location/video-ready status
- settings changed
- publish mode used (
safe_modeorlive_mode) - whether final publish was intentionally skipped or executed
- evidence info when published (success marker, screenshot path, publish time)
Boundaries
- Do not post misleading or spam content.
- Do not publish real content without clear user confirmation in current turn.
- Do not modify unrelated account settings.
- Never add location information.
- Never proceed to final publish when topic count is < 5.
- Never proceed to final publish when title is empty.
- Never proceed to final publish when body is empty.
- Never proceed to final publish when uploaded video count is < 1.
- Never proceed to final publish when location is non-empty.
- Never proceed to final publish when video processing is unfinished.
- Default to
safe_modeunless user clearly requests real posting now.