@acedatacloud/skills 2026.713.3 → 2026.713.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/AGENTS.md +1 -0
  2. package/README.md +2 -0
  3. package/package.json +2 -1
  4. package/skills/_shared/mcp-servers.md +1 -0
  5. package/skills/happyhorse-video/SKILL.md +190 -0
  6. package/skills/xiaohongshu/README.md +36 -0
  7. package/skills/xiaohongshu/SKILL.md +173 -0
  8. package/skills/xiaohongshu/requirements.txt +1 -0
  9. package/skills/xiaohongshu/scripts/vendor/LICENSE.autoclaw-xiaohongshu-skills +21 -0
  10. package/skills/xiaohongshu/scripts/vendor/title_utils.py +57 -0
  11. package/skills/xiaohongshu/scripts/vendor/xhs/__init__.py +1 -0
  12. package/skills/xiaohongshu/scripts/vendor/xhs/cdp.py +830 -0
  13. package/skills/xiaohongshu/scripts/vendor/xhs/comment.py +283 -0
  14. package/skills/xiaohongshu/scripts/vendor/xhs/errors.py +92 -0
  15. package/skills/xiaohongshu/scripts/vendor/xhs/feed_detail.py +550 -0
  16. package/skills/xiaohongshu/scripts/vendor/xhs/feeds.py +49 -0
  17. package/skills/xiaohongshu/scripts/vendor/xhs/human.py +79 -0
  18. package/skills/xiaohongshu/scripts/vendor/xhs/like_favorite.py +188 -0
  19. package/skills/xiaohongshu/scripts/vendor/xhs/login.py +377 -0
  20. package/skills/xiaohongshu/scripts/vendor/xhs/publish.py +1088 -0
  21. package/skills/xiaohongshu/scripts/vendor/xhs/publish_long_article.py +293 -0
  22. package/skills/xiaohongshu/scripts/vendor/xhs/publish_video.py +183 -0
  23. package/skills/xiaohongshu/scripts/vendor/xhs/search.py +226 -0
  24. package/skills/xiaohongshu/scripts/vendor/xhs/selectors.py +97 -0
  25. package/skills/xiaohongshu/scripts/vendor/xhs/stealth.py +316 -0
  26. package/skills/xiaohongshu/scripts/vendor/xhs/types.py +473 -0
  27. package/skills/xiaohongshu/scripts/vendor/xhs/urls.py +30 -0
  28. package/skills/xiaohongshu/scripts/vendor/xhs/user_profile.py +111 -0
  29. package/skills/xiaohongshu/scripts/xiaohongshu.py +1178 -0
  30. package/skills/xiaohongshu/tests/test_xiaohongshu.py +605 -0
package/AGENTS.md CHANGED
@@ -22,6 +22,7 @@ Skills are located in the `skills/` directory (also mirrored to `.agents/skills/
22
22
  - **veo-video** — Generate videos with Google Veo (native audio)
23
23
  - **kling-video** — Generate videos with Kuaishou Kling (motion control)
24
24
  - **hailuo-video** — Generate videos with Hailuo / MiniMax
25
+ - **happyhorse-video** — Generate and edit videos with Happy Horse
25
26
  - **seedance-video** — Generate dance/motion videos with ByteDance Seedance
26
27
  - **wan-video** — Generate videos with Alibaba Wan
27
28
  - **maestro-video** — Produce complete videos from a brief with scripting, media, voiceover, editing, captions, and multilingual variants
package/README.md CHANGED
@@ -39,6 +39,7 @@ Compatible with **30+ AI coding agents** via the [agentskills.io](https://agents
39
39
  | [veo-video](skills/veo-video/) | Generate videos with Google Veo (native audio) |
40
40
  | [kling-video](skills/kling-video/) | Generate videos with Kuaishou Kling (motion control) |
41
41
  | [hailuo-video](skills/hailuo-video/) | Generate videos with Hailuo / MiniMax |
42
+ | [happyhorse-video](skills/happyhorse-video/) | Generate and edit videos with Happy Horse |
42
43
  | [seedance-video](skills/seedance-video/) | Generate dance/motion videos with ByteDance Seedance |
43
44
  | [maestro-video](skills/maestro-video/) | Produce complete videos from a brief with script, media, voiceover, captions, and editing |
44
45
 
@@ -211,6 +212,7 @@ Skills provide **knowledge** (when to use, parameters, gotchas). MCP servers pro
211
212
  | veo-video | [mcp-veo](https://pypi.org/project/mcp-veo/) | `pip install mcp-veo` | `https://veo.mcp.acedata.cloud/mcp` |
212
213
  | seedream-image | [mcp-seedream](https://pypi.org/project/mcp-seedream/) | `pip install mcp-seedream` | `https://seedream.mcp.acedata.cloud/mcp` |
213
214
  | seedance-video | [mcp-seedance](https://pypi.org/project/mcp-seedance/) | `pip install mcp-seedance` | `https://seedance.mcp.acedata.cloud/mcp` |
215
+ | happyhorse-video | [mcp-happyhorse](https://pypi.org/project/mcp-happyhorse/) | `pip install mcp-happyhorse` | `https://happyhorse.mcp.acedata.cloud/mcp` |
214
216
  | maestro-video | [mcp-maestro](https://pypi.org/project/mcp-maestro/) | `pip install mcp-maestro` | `https://maestro.mcp.acedata.cloud/mcp` |
215
217
  | nano-banana-image | [mcp-nano-banana](https://pypi.org/project/mcp-nano-banana/) | `pip install mcp-nano-banana` | `https://nano-banana.mcp.acedata.cloud/mcp` |
216
218
  | short-url | [mcp-shorturl](https://pypi.org/project/mcp-shorturl/) | `pip install mcp-shorturl` | `https://short-url.mcp.acedata.cloud/mcp` |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acedatacloud/skills",
3
- "version": "2026.713.3",
3
+ "version": "2026.713.5",
4
4
  "description": "Agent Skills for AceDataCloud AI services — music, image, video generation, LLM chat, web search. Compatible with Claude Code, GitHub Copilot, Gemini CLI, OpenAI Codex, and 30+ AI coding agents.",
5
5
  "keywords": [
6
6
  "agent-skills",
@@ -16,6 +16,7 @@
16
16
  "luma",
17
17
  "sora",
18
18
  "veo",
19
+ "happyhorse",
19
20
  "ai-music",
20
21
  "ai-image",
21
22
  "ai-video",
@@ -15,6 +15,7 @@ Each AceDataCloud service has a corresponding MCP server that provides tool-use
15
15
  | veo-video | `pip install mcp-veo` | `https://veo.mcp.acedata.cloud/mcp` |
16
16
  | seedream-image | `pip install mcp-seedream` | `https://seedream.mcp.acedata.cloud/mcp` |
17
17
  | seedance-video | `pip install mcp-seedance` | `https://seedance.mcp.acedata.cloud/mcp` |
18
+ | happyhorse-video | `pip install mcp-happyhorse` | `https://happyhorse.mcp.acedata.cloud/mcp` |
18
19
  | maestro-video | `pip install mcp-maestro` | `https://maestro.mcp.acedata.cloud/mcp` |
19
20
  | nano-banana-image | `pip install mcp-nano-banana` | `https://nano-banana.mcp.acedata.cloud/mcp` |
20
21
  | short-url | `pip install mcp-shorturl` | `https://short-url.mcp.acedata.cloud/mcp` |
@@ -0,0 +1,190 @@
1
+ ---
2
+ name: happyhorse-video
3
+ description: Generate and edit AI videos with Happy Horse via AceDataCloud API. Use when creating videos from text prompts, animating a first-frame image, generating scenes from up to 9 subject or style reference images, or editing an existing video with optional references. Supports 720P/1080P output, 3-15 second generation, aspect-ratio control, audio preservation, seeds, callbacks, and asynchronous task polling.
4
+ license: Apache-2.0
5
+ metadata:
6
+ author: acedatacloud
7
+ version: "1.0"
8
+ compatibility: Requires ACEDATACLOUD_API_TOKEN in .env file (see _shared/authentication.md). Optionally pair with mcp-happyhorse for tool-use.
9
+ ---
10
+
11
+ # Happy Horse Video Generation and Editing
12
+
13
+ Use Happy Horse through AceDataCloud for text-to-video, first-frame animation, reference-guided
14
+ generation, and video editing.
15
+
16
+ > **Setup:** See [authentication](../_shared/authentication.md) for token setup.
17
+
18
+ ## Choose an Action
19
+
20
+ | Goal | `action` | Valid models | Required input |
21
+ |---|---|---|---|
22
+ | Generate from text | `generate` | `happyhorse-1.0-t2v`, `happyhorse-1.1-t2v` | `prompt` |
23
+ | Animate one image | `image_to_video` | `happyhorse-1.0-i2v`, `happyhorse-1.1-i2v` | `image_url` |
24
+ | Generate from references | `reference_to_video` | `happyhorse-1.0-r2v`, `happyhorse-1.1-r2v` | `prompt`, 1-9 `image_urls` |
25
+ | Edit a video | `video_edit` | `happyhorse-1.0-video-edit` | `prompt`, `video_url` |
26
+
27
+ The 1.1 model is the default where available. Video editing currently has only a 1.0 model.
28
+
29
+ ## Quick Start
30
+
31
+ Submit text-to-video asynchronously:
32
+
33
+ ```bash
34
+ curl -X POST https://api.acedata.cloud/happyhorse/videos \
35
+ -H "Authorization: Bearer $ACEDATACLOUD_API_TOKEN" \
36
+ -H "Content-Type: application/json" \
37
+ -d '{
38
+ "action": "generate",
39
+ "model": "happyhorse-1.1-t2v",
40
+ "prompt": "A cinematic white horse crossing a snowy ridge at sunrise, wind moving its mane, slow camera push",
41
+ "resolution": "720P",
42
+ "ratio": "16:9",
43
+ "duration": 5,
44
+ "async": true
45
+ }'
46
+ ```
47
+
48
+ The response contains a `task_id`. Poll it after about 15 seconds:
49
+
50
+ ```bash
51
+ curl -X POST https://api.acedata.cloud/happyhorse/tasks \
52
+ -H "Authorization: Bearer $ACEDATACLOUD_API_TOKEN" \
53
+ -H "Content-Type: application/json" \
54
+ -d '{"id": "<task_id>", "action": "retrieve"}'
55
+ ```
56
+
57
+ > **Async:** See [async task polling](../_shared/async-tasks.md). Continue until
58
+ > `response.data[].video_url` appears or a terminal error is returned.
59
+
60
+ ## Workflows
61
+
62
+ ### Text-to-Video
63
+
64
+ Use `generate` when no visual input exists. Describe the subject, action, environment, camera,
65
+ lighting, and style.
66
+
67
+ ```json
68
+ POST /happyhorse/videos
69
+ {
70
+ "action": "generate",
71
+ "model": "happyhorse-1.1-t2v",
72
+ "prompt": "A white horse gallops across a moonlit beach, side tracking shot, silver reflections, cinematic realism",
73
+ "resolution": "1080P",
74
+ "ratio": "16:9",
75
+ "duration": 8,
76
+ "seed": 42
77
+ }
78
+ ```
79
+
80
+ ### First-Frame Image-to-Video
81
+
82
+ Use `image_to_video` to animate one image. `prompt` is optional but useful for motion and camera
83
+ direction. The output ratio follows the first-frame image, so omit `ratio`.
84
+
85
+ ```json
86
+ POST /happyhorse/videos
87
+ {
88
+ "action": "image_to_video",
89
+ "model": "happyhorse-1.1-i2v",
90
+ "image_url": "https://example.com/horse.jpg",
91
+ "prompt": "The horse slowly lifts its head as the mane moves in the breeze, gentle camera push",
92
+ "resolution": "1080P",
93
+ "duration": 5
94
+ }
95
+ ```
96
+
97
+ ### Reference-to-Video
98
+
99
+ Use `reference_to_video` with 1-9 reference images. Mention images as `character1`, `character2`,
100
+ and so on in list order when the prompt needs to distinguish them.
101
+
102
+ ```json
103
+ POST /happyhorse/videos
104
+ {
105
+ "action": "reference_to_video",
106
+ "model": "happyhorse-1.1-r2v",
107
+ "prompt": "character1 walks through a sunrise meadow wearing the leather and gold style from character2",
108
+ "image_urls": [
109
+ "https://example.com/subject.jpg",
110
+ "https://example.com/style.jpg"
111
+ ],
112
+ "resolution": "720P",
113
+ "ratio": "16:9",
114
+ "duration": 5
115
+ }
116
+ ```
117
+
118
+ ### Video Editing
119
+
120
+ Use `video_edit` with an existing video and editing instructions. Add at most 5 reference images
121
+ for wardrobe, subject, style, or local replacement guidance. Use `audio_setting: "origin"` to
122
+ preserve the source audio.
123
+
124
+ ```json
125
+ POST /happyhorse/videos
126
+ {
127
+ "action": "video_edit",
128
+ "model": "happyhorse-1.0-video-edit",
129
+ "prompt": "Apply the warm leather and gold style from the reference while preserving camera motion",
130
+ "video_url": "https://example.com/source.mp4",
131
+ "image_urls": ["https://example.com/style.jpg"],
132
+ "resolution": "720P",
133
+ "audio_setting": "origin"
134
+ }
135
+ ```
136
+
137
+ Do not send `duration` or `ratio` for video editing. Output duration follows the source video.
138
+
139
+ ## Parameters
140
+
141
+ | Parameter | Values | Notes |
142
+ |---|---|---|
143
+ | `action` | `generate`, `image_to_video`, `reference_to_video`, `video_edit` | Defaults to `generate` |
144
+ | `model` | See action table | The model family must match the action |
145
+ | `prompt` | string | Required except for `image_to_video` |
146
+ | `image_url` | URL | First frame for `image_to_video` |
147
+ | `image_urls` | URL array | 1-9 for reference generation; 0-5 for editing |
148
+ | `video_url` | URL | Required only for editing |
149
+ | `resolution` | `720P`, `1080P` | Uppercase `P` is required; default `1080P` |
150
+ | `ratio` | `16:9`, `9:16`, `1:1`, `4:3`, `3:4` | Text/reference generation only |
151
+ | `duration` | integer 3-15 | Generation only; default 5 seconds |
152
+ | `watermark` | boolean | Default `false` |
153
+ | `audio_setting` | `auto`, `origin` | Video editing only; `origin` preserves source audio |
154
+ | `seed` | integer 0-2147483647 | Optional reproducibility seed |
155
+ | `callback_url` | URL | Webhook for final result; returns immediately |
156
+ | `async` | boolean | Set `true` to return a task ID for polling |
157
+
158
+ ## Task Queries
159
+
160
+ Retrieve one task:
161
+
162
+ ```json
163
+ POST /happyhorse/tasks
164
+ {"id": "<task_id>", "action": "retrieve"}
165
+ ```
166
+
167
+ Retrieve several tasks:
168
+
169
+ ```json
170
+ POST /happyhorse/tasks
171
+ {"ids": ["<task_id_1>", "<task_id_2>"], "action": "retrieve_batch"}
172
+ ```
173
+
174
+ A completed single-task response stores the original request in `request` and the final API result
175
+ in `response`. Read the media URL from `response.data[].video_url`.
176
+
177
+ ## Gotchas
178
+
179
+ - Match the model family to `action`; for example, an `*-i2v` model is invalid for `generate`
180
+ - Resolution values are `720P` and `1080P`, not lowercase `720p` / `1080p`
181
+ - Generated duration must be an integer from 3 through 15 seconds
182
+ - `image_to_video` requires `image_url`; its prompt is optional and its ratio follows the image
183
+ - `reference_to_video` requires a prompt and 1-9 images
184
+ - `video_edit` requires both prompt and video URL, accepts at most 5 references, and ignores duration/ratio
185
+ - `audio_setting` applies to video editing; use `origin` to preserve source audio
186
+ - A `task_id` is not a completed result; poll until a final video URL or terminal error appears
187
+ - Failed tasks are not billed; video edits use the upstream-reported input plus output duration for billing
188
+
189
+ > **MCP:** `pip install mcp-happyhorse` | Hosted:
190
+ > `https://happyhorse.mcp.acedata.cloud/mcp` | See [all MCP servers](../_shared/mcp-servers.md)
@@ -0,0 +1,36 @@
1
+ # Xiaohongshu Connector Skill
2
+
3
+ AceDataCloud adaptation for operating Xiaohongshu through an encrypted BYOC cookie connector. It runs Chromium directly over CDP inside the existing Skill sandbox; no hosted or long-running MCP server is required.
4
+
5
+ ## Provenance
6
+
7
+ This Skill is rewritten from [`xpzouying/xiaohongshu-mcp`](https://github.com/xpzouying/xiaohongshu-mcp), used by AceDataCloud with permission from its author. The connector-cookie adapter, direct-CDP process isolation, confirmation gates, and Agent Skill integration are AceDataCloud changes.
8
+
9
+ The browser business modules, workflow structure, split preview/confirmation approach, validation ideas, and operational guidance are adapted from MIT-licensed [`autoclaw-cc/xiaohongshu-skills`](https://github.com/autoclaw-cc/xiaohongshu-skills):
10
+
11
+ - Business modules: commit `b043748282a57e347c52f517dfb59819121134ab`.
12
+ - Hardened direct-CDP runtime: commit `406e0590523f`.
13
+ - The upstream MIT license is retained at `scripts/vendor/LICENSE.autoclaw-xiaohongshu-skills`.
14
+
15
+ No AutoClaw browser extension, local WebSocket bridge, persistent Chrome profile, or hosted MCP server is used.
16
+
17
+ ## Capabilities
18
+
19
+ - Login status and connected account identity.
20
+ - Home recommendations, filtered search, note details and comments, and user profiles.
21
+ - Image, video, and formatted text-only long-article publishing.
22
+ - Tags, scheduled publishing, visibility, original declaration, templates, and product binding.
23
+ - Comments, comment replies, likes/unlikes, and favorites/unfavorites.
24
+ - Private messages remain in the Android-only `xhs-dm` Skill.
25
+
26
+ ## Security model
27
+
28
+ - AuthBackend stores the browser-extension cookie jar encrypted.
29
+ - aichat2 injects it as `XIAOHONGSHU_COOKIES` only while this Skill is active.
30
+ - The CLI validates domains and converts Chrome-extension cookie fields to CDP `CookieParam` records.
31
+ - Cookies are injected through `Storage.setCookies` into an incognito Chromium context instead of being passed through files or command arguments.
32
+ - Each command creates a private temporary profile, starts Chromium on a random loopback CDP port, then terminates Chromium and removes the entire profile.
33
+ - Chromium receives a minimal child environment that excludes `XIAOHONGSHU_COOKIES`; Cookie values are never placed in process arguments or model-visible output.
34
+ - Real account writes dry-run unless the invocation ends with `--confirm`; the Skill instructions require a structured user confirmation before that second invocation.
35
+
36
+ Xiaohongshu's web "draft box" is stored in the browser profile rather than the connected account. This Skill deliberately destroys its temporary profile after each command, so it uses code-enforced dry-run previews instead of claiming durable Xiaohongshu drafts. Confirmation is an orchestration policy, not a cryptographic authorization boundary.
@@ -0,0 +1,173 @@
1
+ ---
2
+ name: xiaohongshu
3
+ description: Read, search, preview, publish, and interact on 小红书 / Xiaohongshu / RED using the user's connected account. Supports recommendations, details/comments, profiles, image/video/long-article publishing, schedules, product binding, comments/replies, likes, and favorites. Real writes always dry-run first and require explicit confirmation.
4
+ when_to_use: |
5
+ Trigger when the user asks to use their connected 小红书 / Xiaohongshu / RED account:
6
+ check account status, browse recommendations, search notes, inspect comments or profiles,
7
+ preview or publish image/video/long-article notes, schedule a note, bind products,
8
+ comment/reply, like/unlike, or favorite/unfavorite.
9
+ Private messages are handled by the separate Android-only xhs-dm skill.
10
+ connections: [xiaohongshu]
11
+ allowed_tools: [Bash]
12
+ license: Apache-2.0
13
+ metadata:
14
+ author: acedatacloud
15
+ version: "1.0"
16
+ ---
17
+
18
+ # Xiaohongshu connector
19
+
20
+ Operate the user's real Xiaohongshu account using the login cookies they captured with the ACE extension. The runtime injects `XIAOHONGSHU_COOKIES`; never print, inspect, or pass that value on the command line.
21
+
22
+ This Skill is rewritten for AceDataCloud from the authorized [`xpzouying/xiaohongshu-mcp`](https://github.com/xpzouying/xiaohongshu-mcp) automation engine. Browser modules, workflow, and safety patterns are adapted from MIT-licensed [`autoclaw-cc/xiaohongshu-skills`](https://github.com/autoclaw-cc/xiaohongshu-skills). See [`README.md`](README.md) for pinned commits and provenance.
23
+
24
+ ## Locate the CLI
25
+
26
+ Every Bash call is a fresh shell. Resolve the script at the start of each call:
27
+
28
+ ```sh
29
+ XHS="$SKILL_DIR/scripts/xiaohongshu.py"
30
+ [ -f "$XHS" ] || XHS=$(find /tmp -maxdepth 8 -path '*/skills/*/scripts/xiaohongshu.py' 2>/dev/null | head -1)
31
+ [ -f "$XHS" ] || { echo "xiaohongshu skill runtime not found" >&2; exit 1; }
32
+ ```
33
+
34
+ ## Read operations
35
+
36
+ Run these directly:
37
+
38
+ ```sh
39
+ python3 "$XHS" status
40
+ python3 "$XHS" whoami
41
+ python3 "$XHS" feeds
42
+
43
+ python3 "$XHS" search --keyword "AI Agent"
44
+ python3 "$XHS" search --keyword "旅行" --sort-by 最新 --note-type 图文 --publish-time 一周内
45
+
46
+ python3 "$XHS" detail --feed-id FEED_ID --xsec-token XSEC_TOKEN --xsec-source XSEC_SOURCE
47
+ python3 "$XHS" detail --feed-id FEED_ID --xsec-token XSEC_TOKEN --xsec-source XSEC_SOURCE --load-all-comments --limit 50
48
+ python3 "$XHS" profile --user-id USER_ID --xsec-token XSEC_TOKEN
49
+ ```
50
+
51
+ Search/feed results contain the `feed_id`, `xsec_token`, `xsecSource`, and author `user_id` needed by detail, profile, and interaction commands. Preserve `xsecSource`: recommendation/search rows use `pc_feed`, while rows returned from a user profile use `pc_note`. Do not invent those identifiers.
52
+
53
+ ## Image publishing
54
+
55
+ `publish` accepts 1-18 images. Each `--images` value is either a public HTTPS URL or an existing absolute sandbox path. Text can be inline or read from an absolute UTF-8 file.
56
+
57
+ ```sh
58
+ # Dry-run: validates and shows the exact public write, but changes nothing.
59
+ python3 "$SKILL_DIR/scripts/xiaohongshu.py" publish \
60
+ --title "标题" \
61
+ --content-file /absolute/path/content.txt \
62
+ --images https://cdn.example.com/1.jpg \
63
+ --images /absolute/path/2.png \
64
+ --tags AI --tags 效率 \
65
+ --visibility 仅自己可见
66
+
67
+ # After the dry-run, show the complete preview and use `ask_user_question`.
68
+ # Only after the user selects `确认执行`, repeat the exact command with
69
+ # `--confirm` as its final argument:
70
+ python3 "$XHS" publish \
71
+ --title "标题" \
72
+ --content-file /absolute/path/content.txt \
73
+ --images https://cdn.example.com/1.jpg \
74
+ --tags AI --visibility 仅自己可见 \
75
+ --preview-digest DIGEST \
76
+ --confirm
77
+ ```
78
+
79
+ The CLI defaults every write command to dry-run. Xiaohongshu web drafts live only in the browser profile, while this Skill intentionally destroys its temporary profile after every command to prevent account crossover.
80
+
81
+ After showing the complete dry-run, pause with this exact card shape (replace `PREFIX` with the first 12 characters of `preview_digest`):
82
+
83
+ ```json
84
+ {
85
+ "questions": [{
86
+ "header": "小红书确认",
87
+ "question": "确认执行已展示的小红书写操作?预览摘要 PREFIX",
88
+ "options": [
89
+ {"label": "确认执行", "description": "执行刚刚展示的完整预览"},
90
+ {"label": "取消", "description": "不执行任何账号写操作"}
91
+ ]
92
+ }]
93
+ }
94
+ ```
95
+
96
+ Optional publishing flags:
97
+
98
+ - `--schedule-at <ISO8601>`: 1 hour to 14 days ahead.
99
+ - `--visibility`: `公开可见`, `仅自己可见`, or `仅互关好友可见`.
100
+ - `--original`: declare original content.
101
+ - Repeat `--products` to bind products; the account must have product permissions.
102
+
103
+ ## Video publishing
104
+
105
+ Video must be an existing absolute local path. Remote video URLs are rejected; download the user's supplied file into the sandbox first.
106
+
107
+ ```sh
108
+ python3 "$XHS" publish-video --title "标题" --content "描述" --video /absolute/video.mp4 --tags 视频
109
+ # After explicit confirmation, repeat the exact command with --confirm last:
110
+ python3 "$XHS" publish-video --title "标题" --content "描述" --video /absolute/video.mp4 --tags 视频 --preview-digest DIGEST --confirm
111
+ ```
112
+
113
+ Use Bash's maximum `timeout: 120` for confirmed video operations. Report a timeout without retrying the write, because the publish may already have reached Xiaohongshu.
114
+
115
+ ## Long articles
116
+
117
+ Long articles support a named layout template, an independent post description, scheduling, visibility, original declaration, and products. Inline images are currently rejected because Xiaohongshu's web editor has no upload flow this Skill can verify; image notes remain fully supported. If `--template` is omitted, the first available template is selected.
118
+
119
+ ```sh
120
+ python3 "$SKILL_DIR/scripts/xiaohongshu.py" publish-long \
121
+ --title "长文标题" \
122
+ --content-file /absolute/path/article.txt \
123
+ --description "发布页摘要" \
124
+ --visibility 仅自己可见
125
+
126
+ # After explicit confirmation, repeat the exact command with --confirm last:
127
+ python3 "$XHS" publish-long \
128
+ --title "长文标题" \
129
+ --content-file /absolute/path/article.txt \
130
+ --description "发布页摘要" \
131
+ --visibility 仅自己可见 \
132
+ --preview-digest DIGEST \
133
+ --confirm
134
+ ```
135
+
136
+ ## Interactions
137
+
138
+ Every interaction is a real account write and follows the same dry-run then confirm flow. Repeat the exact previewed command with `--confirm` as the final argument only after explicit confirmation.
139
+
140
+ ```sh
141
+ python3 "$XHS" comment --feed-id ID --xsec-token TOKEN --xsec-source SOURCE --content "评论"
142
+ python3 "$XHS" comment --feed-id ID --xsec-token TOKEN --xsec-source SOURCE --content "评论" --preview-digest DIGEST --confirm
143
+
144
+ python3 "$XHS" reply --feed-id ID --xsec-token TOKEN --xsec-source SOURCE --comment-id COMMENT_ID --content "回复"
145
+ python3 "$XHS" reply --feed-id ID --xsec-token TOKEN --xsec-source SOURCE --comment-id COMMENT_ID --content "回复" --preview-digest DIGEST --confirm
146
+
147
+ python3 "$XHS" like --feed-id ID --xsec-token TOKEN --xsec-source SOURCE
148
+ python3 "$XHS" like --feed-id ID --xsec-token TOKEN --xsec-source SOURCE --preview-digest DIGEST --confirm
149
+ python3 "$XHS" unlike --feed-id ID --xsec-token TOKEN --xsec-source SOURCE --preview-digest DIGEST --confirm
150
+
151
+ python3 "$XHS" favorite --feed-id ID --xsec-token TOKEN --xsec-source SOURCE --preview-digest DIGEST --confirm
152
+ python3 "$XHS" unfavorite --feed-id ID --xsec-token TOKEN --xsec-source SOURCE --preview-digest DIGEST --confirm
153
+ ```
154
+
155
+ For reversible tests or temporary actions, inspect the current `liked` / `collected` state first and restore that exact state afterward.
156
+
157
+ ## Mandatory write policy
158
+
159
+ - Never add `--confirm` until the user has seen the exact dry-run and selected `确认执行` in the required structured confirmation card. Plain prose from the model is not approval.
160
+ - The confirmation card must use header `小红书确认`, exactly `确认执行` / `取消` options, and include the dry-run digest's first 12 hex characters in its question.
161
+ - Repeat the exact previewed arguments and pass its `preview_digest`; if anything changes, the CLI rejects the write and requires a new dry-run.
162
+ - A confirmed write must be one direct `python3 "$SKILL_DIR/scripts/xiaohongshu.py" ... --confirm` command. Never add shell chaining, redirection, command substitution, or wrappers.
163
+ - `--confirm` is honored only as the final argument.
164
+ - Do not batch-comment, mass-like, mass-favorite, or perform unsolicited engagement.
165
+ - Stop immediately on CAPTCHA, verification, risk-control, rate-limit, or account-restriction errors. Do not retry around them.
166
+ - Do not publish external links, contact details, or promotional spam unless the user explicitly supplied and approved them.
167
+ - Scheduled/unattended runs may read or produce dry-run previews only. Xiaohongshu writes always require an interactive confirmation.
168
+
169
+ ## Authentication and errors
170
+
171
+ Authentication belongs to the Connector, not this skill. It does not expose QR login or cookie deletion. If status reports logged out, ask the user to reconnect at <https://auth.acedata.cloud/user/connections> using the ACE extension.
172
+
173
+ The browser automation follows Xiaohongshu's web UI and can drift. Report the exact safe error summary; never dump runtime logs, environment variables, cookies, or `xsec_token` values in errors or write previews.
@@ -0,0 +1 @@
1
+ urllib3==2.2.3
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Auto-Claw-CC
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,57 @@
1
+ """UTF-16 标题长度计算,对应 Go pkg/xhsutil/title.go。"""
2
+
3
+ from __future__ import annotations
4
+
5
+ MAX_TITLE_LENGTH = 20
6
+
7
+
8
+ def truncate_title(s: str, max_length: int = MAX_TITLE_LENGTH) -> str:
9
+ """将标题裁剪到 max_length 以内(逐字符从末尾去除)。
10
+
11
+ Args:
12
+ s: 原始标题。
13
+ max_length: 最大允许长度(默认 20)。
14
+
15
+ Returns:
16
+ 满足长度要求的标题字符串。
17
+ """
18
+ if calc_title_length(s) <= max_length:
19
+ return s
20
+ while s and calc_title_length(s) > max_length:
21
+ s = s[:-1]
22
+ return s
23
+
24
+
25
+ def calc_title_length(s: str) -> int:
26
+ """计算小红书标题长度。
27
+
28
+ 规则(同 Go CalcTitleLength):
29
+ - 非 ASCII 字符(中文、全角符号、emoji 代码单元等)算 2
30
+ - ASCII 字符算 1
31
+ - 最终结果向上取整除以 2,上限 MAX_TITLE_LENGTH = 20
32
+
33
+ Emoji 按 UTF-16 码元计数:
34
+ - 基础 emoji(如 ✨ U+2728, BMP)= 1 码元 → 权重 2 → 贡献 1
35
+ - SMP emoji(如 💇 U+1F487,surrogate pair)= 2 码元 → 权重 4 → 贡献 2
36
+ - ZWJ 序列(如 💇‍♀️)= 5 码元 → 权重 10 → 贡献 5
37
+ - 旗帜(如 🇨🇳,2 个 regional indicator)= 4 码元 → 权重 8 → 贡献 4
38
+
39
+ Examples:
40
+ >>> calc_title_length("你好世界")
41
+ 4
42
+ >>> calc_title_length("hello")
43
+ 3
44
+ >>> calc_title_length("OOTD穿搭分享")
45
+ 6
46
+ >>> calc_title_length("💇\u200d♀️")
47
+ 5
48
+ """
49
+ byte_len = 0
50
+ encoded = s.encode("utf-16-le")
51
+ for i in range(0, len(encoded), 2):
52
+ code_unit = int.from_bytes(encoded[i : i + 2], "little")
53
+ if code_unit > 127:
54
+ byte_len += 2
55
+ else:
56
+ byte_len += 1
57
+ return (byte_len + 1) // 2
@@ -0,0 +1 @@
1
+ """小红书 CDP 自动化核心包。"""