Files
publish-video-shipinhao/SKILL.md
2026-07-09 13:55:56 +08:00

116 lines
6.3 KiB
Markdown

---
name: publish-video-shipinhao
description: Use when Codex needs to install, configure, use, or troubleshoot OpenClaw, WorkBuddy, or similar automation products for uploading, drafting, scheduling, publishing, or verifying WeChat Channels videos through 微信视频号/视频号助手 browser automation.
---
# Publish Video Shipinhao
## Overview
Automate 微信视频号 video publishing through the 视频号助手 web console with Playwright or a compatible product adapter. Treat the web UI as semi-automated: login, CAPTCHA, account selection, product setup, and final publish confirmation may require the human operator.
## Safety Rules
- Verify product installation and usage steps from official docs or user-provided package docs before installing OpenClaw, WorkBuddy, or related products.
- Do not bypass QR login, CAPTCHA, rate limits, account checks, or platform policy prompts.
- Do not click the final publish button unless the user explicitly asks for live publishing or passes `--publish`.
- Prefer `--validate-config` first, then an upload/fill run without `--publish`, then final publish after reviewing the screenshot.
- Save screenshots and logs for every run so the user can verify what was submitted.
## Quick Start
1. Read `references/config.example.json` when creating a new publish config.
2. If the user mentions OpenClaw, WorkBuddy, or another automation product, read `references/product-adapters.md` before installing or running it.
3. Install Python dependencies when the target environment has not already done so:
```bash
python -m pip install -r requirements.txt
python -m playwright install chromium
```
Skill installation does not automatically install Python packages unless the host product explicitly runs `requirements.txt`; verify this for OpenClaw, WorkBuddy, or any other adapter.
4. Ask the user for missing required fields: `video_path`, `title`, target product/runtime, and whether this should be draft-only, scheduled, or live publishing.
5. Run product environment checks first when a non-default product adapter is requested.
6. Run validation before opening the browser:
```bash
python scripts/publish.py --config path/to/config.json --validate-config
```
7. For first-time login or expired sessions, run headed and let the user scan the QR code:
```bash
python scripts/publish.py --config path/to/config.json --login-only --headed
```
8. Upload and fill metadata without final publish:
```bash
python scripts/publish.py --config path/to/config.json --headed
```
9. Publish only after explicit approval:
```bash
python scripts/publish.py --config path/to/config.json --headed --publish
```
Use `--save-draft` instead of `--publish` when the user wants a draft saved in 视频号助手.
## Workflow
1. Confirm intent: install/setup only, draft, scheduled publish, or live publish.
2. Select the adapter: built-in Playwright script, OpenClaw, WorkBuddy, or a generic browser-automation product.
3. Validate installation docs, local files, and metadata. Reject missing files, empty short title, short titles outside the 6-16 character range, or publish requests without explicit confirmation.
4. Open 视频号助手 with persisted browser/session state. Pause for manual QR login when needed.
5. Navigate to the create-post page, upload the video, optionally upload the cover, and fill title/description/topics.
6. If scheduling is requested, attempt the visible schedule controls; if selectors fail, stop for manual review instead of guessing.
7. Capture a screenshot before any final action.
8. Click `存草稿` or `发表/发布` only when the requested mode requires it.
9. Verify success by checking the toast, URL, list page, or a post-management entry. If verification is ambiguous, report the screenshot and manual check needed.
## Product Adapters
Use `references/product-adapters.md` for OpenClaw, WorkBuddy, and related products. Keep product-specific setup outside the main workflow:
- Treat each product as an adapter with `install`, `configure`, `verify`, `run`, and `collect evidence` steps.
- Prefer official docs, bundled README files, or user-provided install packages over memory.
- Keep adapter-specific commands in the user's project/config, not hard-coded into this skill.
- Require a smoke test before using any installed product to publish a real video.
- Fall back to `scripts/publish.py` when the product cannot expose a controllable browser session, selector map, or evidence capture.
## Bundled Script
Use `scripts/publish.py` for the browser workflow. It supports:
- `--validate-config`: validate JSON and required fields without launching a browser.
- `--skip-file-checks`: useful for config-shape tests when media files are not present.
- `--login-only`: open 视频号助手 and save the QR-login session.
- `--headed`: show the browser, recommended for login and final publishing.
- `--publish`: click the final publish button after filling the form.
- `--save-draft`: click the draft button after filling the form.
- `--review-seconds N`: keep the browser open before final action or close.
When selectors fail, prefer adding page-specific selectors in the config under `selectors` or the product adapter profile instead of hard-coding a new guess in the skill instructions.
## Dependencies
The Python dependency manifest is `requirements.txt`. It currently installs Playwright only. Browser binaries are not installed by `pip`; run `python -m playwright install chromium` after installing Python packages.
## Configuration
Load `references/config.example.json` when preparing a new config. Required fields are:
- `video_path`: absolute or working-directory-relative path to the video file.
- `title`: 视频号 short title, 6-16 characters.
Common optional fields are `description`, `topics`, `cover_path`, `publish_at`, `visibility`, `browser.storage_state`, `product_adapter`, and `selectors`.
## Common Mistakes
- Running headless for first login. Use `--headed` so the user can scan the QR code.
- Installing OpenClaw, WorkBuddy, or a related product from memory. Check official or package docs first.
- Treating upload completion as publish completion. Always wait for a visible success signal or manual confirmation.
- Guessing a changed selector and clicking the wrong button. Stop, screenshot, and inspect the page when controls are ambiguous.
- Forgetting that platform rules and account permissions can block publishing even when upload automation succeeds.