Track bundled vendor runtime sources
This commit is contained in:
54
vendor/social-auto-upload/skills/bilibili-upload/SKILL.md
vendored
Normal file
54
vendor/social-auto-upload/skills/bilibili-upload/SKILL.md
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
---
|
||||
name: bilibili-upload
|
||||
description: 当 agent 需要通过已安装的 `sau` CLI 完成 Bilibili 登录、账号校验或视频上传时使用这个 skill。优先使用 `sau bilibili ...`,程序会自动准备 `biliup`,不要求用户手动安装。
|
||||
---
|
||||
|
||||
# Bilibili 上传 Skill
|
||||
|
||||
优先把 `sau` 作为主接口。
|
||||
|
||||
不要一开始就让用户自己找 `biliup` 或手动下载 release。
|
||||
程序会在运行时自动检查、自动下载、自动更新 `biliup`。
|
||||
|
||||
## 功能概览
|
||||
|
||||
| 功能 | 命令入口 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| 登录 | `sau bilibili login --account <name>` | 需要用户自己在本地真实终端里执行,用于生成或刷新登录信息 |
|
||||
| 校验 | `sau bilibili check --account <name>` | 检查指定账号当前是否有效 |
|
||||
| 视频上传 | `sau bilibili upload-video ...` | 上传一条 Bilibili 视频 |
|
||||
|
||||
## 默认工作流
|
||||
|
||||
1. 先确认 `references/runtime-requirements.md`
|
||||
2. 再确认 `references/cli-contract.md`
|
||||
3. 执行匹配的 `sau bilibili ...` 命令
|
||||
4. 如果命令失败,再看 `references/troubleshooting.md`
|
||||
|
||||
## 命令选择建议
|
||||
|
||||
- 用户没有登录信息,先让用户自己在本地终端执行 `login`
|
||||
- 用户只想确认账号状态,先用 `check`
|
||||
- 用户要发视频,用 `upload-video`
|
||||
|
||||
## 执行前检查
|
||||
|
||||
- 优先确认当前环境能运行 `sau`
|
||||
- 如果 `sau` 不在 PATH 中,可以用仓库里的 `sau_cli.py`
|
||||
- 不要要求用户手动下载 `biliup`
|
||||
- 第一次运行 Bilibili 命令时,程序可能会自动联网准备 `biliup`
|
||||
- 对 agent 来说,不要在非交互环境里硬跑 `sau bilibili login`
|
||||
- 正确做法是让用户自己在本地终端执行 `sau bilibili login --account <name>`
|
||||
- 如果终端里的二维码显示不完整,提醒用户直接打开当前目录下的 `qrcode.png` 扫码
|
||||
|
||||
## 模板文件
|
||||
|
||||
- `scripts/examples/bilibili_commands.ps1`
|
||||
- `scripts/examples/bilibili_commands.sh`
|
||||
- `scripts/examples/bilibili_cli_template.py`
|
||||
|
||||
## 参考文档
|
||||
|
||||
- 运行前提:`references/runtime-requirements.md`
|
||||
- CLI 契约:`references/cli-contract.md`
|
||||
- 故障排查:`references/troubleshooting.md`
|
||||
66
vendor/social-auto-upload/skills/bilibili-upload/references/cli-contract.md
vendored
Normal file
66
vendor/social-auto-upload/skills/bilibili-upload/references/cli-contract.md
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
# Bilibili CLI 契约
|
||||
|
||||
这个 skill 默认假设当前环境已经安装并可调用 `sau` 命令。
|
||||
|
||||
## 命令列表
|
||||
|
||||
### 登录
|
||||
|
||||
```bash
|
||||
sau bilibili login --account <account>
|
||||
```
|
||||
|
||||
- 必填参数:
|
||||
- `--account`
|
||||
- 作用:
|
||||
- 自动准备 `biliup`
|
||||
- 触发 Bilibili 登录流程
|
||||
- 账号说明:
|
||||
- `--account` 传的是用户自定义的 `account_name`,不是固定只能叫 `creator`
|
||||
- 一个 `account_name` 对应一个账号文件,可用于多账号隔离和并发任务
|
||||
- 登录方式说明:
|
||||
- 这个命令应该由用户自己在本地真实终端里运行
|
||||
- 如果终端二维码显示不完整,可直接打开当前目录下的 `qrcode.png` 扫码
|
||||
- agent 不应该在非交互环境里硬跑这个命令
|
||||
|
||||
### 校验账号
|
||||
|
||||
```bash
|
||||
sau bilibili check --account <account>
|
||||
```
|
||||
|
||||
- 必填参数:
|
||||
- `--account`
|
||||
- 预期输出:
|
||||
- `valid`
|
||||
- `invalid`
|
||||
|
||||
### 上传视频
|
||||
|
||||
```bash
|
||||
sau bilibili upload-video \
|
||||
--account <account> \
|
||||
--file <video-path> \
|
||||
--title "<title>" \
|
||||
--desc "<desc>" \
|
||||
--tid <category-id> \
|
||||
[--tags tag1,tag2] \
|
||||
[--schedule "YYYY-MM-DD HH:MM"]
|
||||
```
|
||||
|
||||
- 必填参数:
|
||||
- `--account`
|
||||
- `--file`
|
||||
- `--title`
|
||||
- `--desc`
|
||||
- `--tid`
|
||||
- 可选参数:
|
||||
- `--tags`
|
||||
- `--schedule`
|
||||
|
||||
## 额外说明
|
||||
|
||||
- `--tid` 第一版必须传
|
||||
- `--tags` 使用逗号分隔
|
||||
- `--schedule` 走 `sau` 统一时间格式
|
||||
- 程序会自动准备和更新 `biliup`
|
||||
49
vendor/social-auto-upload/skills/bilibili-upload/references/runtime-requirements.md
vendored
Normal file
49
vendor/social-auto-upload/skills/bilibili-upload/references/runtime-requirements.md
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
# 运行前提
|
||||
|
||||
这个 skill 默认假设当前环境已经具备:
|
||||
|
||||
- 已安装 `social-auto-upload`
|
||||
- 可以调用 `sau`,或者至少可以执行 `python sau_cli.py`
|
||||
- 当前机器首次运行时可以联网访问 GitHub Release
|
||||
|
||||
## 关键说明
|
||||
|
||||
用户不需要自己安装 `biliup`。
|
||||
|
||||
当你执行 `sau bilibili ...` 时:
|
||||
|
||||
- 如果本地没有 `biliup`,程序会自动下载
|
||||
- 如果上游 GitHub Release 有更新,程序会自动更新后再继续执行
|
||||
|
||||
## 推荐调用方式
|
||||
|
||||
### `sau` 已在 PATH 中
|
||||
|
||||
```bash
|
||||
sau bilibili --help
|
||||
```
|
||||
|
||||
### 仓库内直接调用
|
||||
|
||||
PowerShell:
|
||||
|
||||
```powershell
|
||||
.\.venv\Scripts\python.exe sau_cli.py bilibili --help
|
||||
```
|
||||
|
||||
bash / zsh:
|
||||
|
||||
```bash
|
||||
python sau_cli.py bilibili --help
|
||||
```
|
||||
|
||||
## 首次运行注意事项
|
||||
|
||||
- 首次运行可能比其他平台更慢,因为要自动准备 `biliup`
|
||||
- 如果网络无法访问 GitHub Release,Bilibili 命令会失败
|
||||
- 一旦本地已经准备好 `biliup`,后续命令会直接复用
|
||||
- `sau bilibili login --account <name>` 需要用户自己在本地真实终端里执行
|
||||
- 如果终端二维码显示不完整,通常可以直接打开当前目录下的 `qrcode.png` 扫码
|
||||
- 如果国内网络访问 GitHub Release 较慢,可先用 `https://gh-proxy.com/` 或 `https://gh-proxy.org/` 辅助访问对应 release 地址排障
|
||||
- 示例:
|
||||
- `https://gh-proxy.org/https://github.com/biliup/biliup/releases/download/v1.1.29/biliupR-v1.1.29-aarch64-linux.tar.xz`
|
||||
69
vendor/social-auto-upload/skills/bilibili-upload/references/troubleshooting.md
vendored
Normal file
69
vendor/social-auto-upload/skills/bilibili-upload/references/troubleshooting.md
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
# Bilibili 常见问题
|
||||
|
||||
## 1. 首次运行很慢
|
||||
|
||||
这是正常情况。
|
||||
|
||||
原因通常是程序正在自动下载 `biliup`。
|
||||
|
||||
## 2. 自动下载失败
|
||||
|
||||
先检查:
|
||||
|
||||
- 当前网络是否能访问 GitHub
|
||||
- GitHub Release 是否可访问
|
||||
- 本地目录是否有写权限
|
||||
- 国内网络较慢时,可先用 `https://gh-proxy.com/` 或 `https://gh-proxy.org/` 辅助访问对应 release 地址排障
|
||||
- 示例:
|
||||
- `https://gh-proxy.org/https://github.com/biliup/biliup/releases/download/v1.1.29/biliupR-v1.1.29-aarch64-linux.tar.xz`
|
||||
|
||||
## 3. `check` 返回 `invalid`
|
||||
|
||||
常见原因:
|
||||
|
||||
- 账号文件不存在
|
||||
- 登录信息已失效
|
||||
- `biliup renew` 失败
|
||||
|
||||
建议:
|
||||
|
||||
```bash
|
||||
sau bilibili login --account <account>
|
||||
```
|
||||
|
||||
## 4. 登录时报 `not a terminal`
|
||||
|
||||
常见原因:
|
||||
|
||||
- 你是在非交互环境里触发了 `sau bilibili login`
|
||||
- 例如 agent 的命令执行器、管道环境、被接管标准输出的进程
|
||||
|
||||
建议:
|
||||
|
||||
- 改成由用户自己在本地真实终端里执行:
|
||||
|
||||
```bash
|
||||
sau bilibili login --account <account>
|
||||
```
|
||||
|
||||
- 如果终端里的二维码显示不完整,直接打开当前目录下的 `qrcode.png` 扫码
|
||||
|
||||
## 5. 上传失败
|
||||
|
||||
优先检查:
|
||||
|
||||
- `--tid` 是否正确
|
||||
- 视频文件是否真实存在
|
||||
- 标题、简介、标签是否符合平台要求
|
||||
- 当前登录信息是否仍然有效
|
||||
|
||||
## 6. 上游更新后行为变化
|
||||
|
||||
当前 Bilibili 集成会自动跟随上游 `biliup` 最新 release。
|
||||
|
||||
如果上游命令行为变化,可能会影响本项目的 Bilibili CLI。
|
||||
|
||||
排障时请同时确认:
|
||||
|
||||
- 当前下载到的 `biliup` 版本
|
||||
- 上游 release 是否有最近变更
|
||||
40
vendor/social-auto-upload/skills/bilibili-upload/scripts/examples/bilibili_cli_template.py
vendored
Normal file
40
vendor/social-auto-upload/skills/bilibili-upload/scripts/examples/bilibili_cli_template.py
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
from conf import BASE_DIR
|
||||
from utils.constant import VideoZoneTypes
|
||||
|
||||
|
||||
def main() -> None:
|
||||
account = "account_a"
|
||||
# account_name is user-defined. One account_name maps to one account file.
|
||||
# You can prepare multiple account names and run them in parallel.
|
||||
cli_path = Path(BASE_DIR) / "sau_cli.py"
|
||||
command = [
|
||||
sys.executable,
|
||||
str(cli_path),
|
||||
"bilibili",
|
||||
"upload-video",
|
||||
"--account",
|
||||
account,
|
||||
"--file",
|
||||
str(Path(BASE_DIR) / "videos" / "demo.mp4"),
|
||||
"--title",
|
||||
"Bilibili CLI Demo",
|
||||
"--desc",
|
||||
"Bilibili CLI Demo",
|
||||
"--tid",
|
||||
str(VideoZoneTypes.SPORTS_FOOTBALL.value),
|
||||
"--tags",
|
||||
"足球,测试",
|
||||
"--schedule",
|
||||
"2026-03-26 16:00",
|
||||
]
|
||||
subprocess.run(command, check=True)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
21
vendor/social-auto-upload/skills/bilibili-upload/scripts/examples/bilibili_commands.ps1
vendored
Normal file
21
vendor/social-auto-upload/skills/bilibili-upload/scripts/examples/bilibili_commands.ps1
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
# 登录
|
||||
# 建议由用户自己在本地真实终端里执行。
|
||||
# 如果终端二维码显示不完整,可以打开当前目录下的 qrcode.png 扫码。
|
||||
$account = "account_a"
|
||||
# account_name is user-defined. One account_name maps to one account file.
|
||||
# You can prepare multiple account names and run them in parallel.
|
||||
|
||||
sau bilibili login --account $account
|
||||
|
||||
# 校验
|
||||
sau bilibili check --account $account
|
||||
|
||||
# 上传视频
|
||||
sau bilibili upload-video `
|
||||
--account $account `
|
||||
--file .\videos\demo.mp4 `
|
||||
--title "Bilibili CLI Demo" `
|
||||
--desc "Bilibili CLI Demo" `
|
||||
--tid 249 `
|
||||
--tags 足球,测试 `
|
||||
--schedule "2026-03-26 16:00"
|
||||
21
vendor/social-auto-upload/skills/bilibili-upload/scripts/examples/bilibili_commands.sh
vendored
Normal file
21
vendor/social-auto-upload/skills/bilibili-upload/scripts/examples/bilibili_commands.sh
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
# login
|
||||
# Run this in a local interactive terminal.
|
||||
# If the terminal QR code is incomplete, open ./qrcode.png and scan that image.
|
||||
account="account_a"
|
||||
# account_name is user-defined. One account_name maps to one account file.
|
||||
# You can prepare multiple account names and run them in parallel.
|
||||
|
||||
sau bilibili login --account "$account"
|
||||
|
||||
# check
|
||||
sau bilibili check --account "$account"
|
||||
|
||||
# upload video
|
||||
sau bilibili upload-video \
|
||||
--account "$account" \
|
||||
--file ./videos/demo.mp4 \
|
||||
--title "Bilibili CLI Demo" \
|
||||
--desc "Bilibili CLI Demo" \
|
||||
--tid 249 \
|
||||
--tags 足球,测试 \
|
||||
--schedule "2026-03-26 16:00"
|
||||
70
vendor/social-auto-upload/skills/douyin-upload/SKILL.md
vendored
Normal file
70
vendor/social-auto-upload/skills/douyin-upload/SKILL.md
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
---
|
||||
name: douyin-upload
|
||||
description: 当 agent 需要通过已安装的 `sau` CLI 完成抖音登录、cookie 校验、视频上传或图文发布时使用这个 skill。该 skill 适用于已经安装 `social-auto-upload` 且可调用 `sau` 命令的环境。优先使用这个 skill 进行稳定的命令式抖音工作流,而不是一开始就阅读 uploader 源码。
|
||||
---
|
||||
|
||||
# 抖音上传 Skill
|
||||
|
||||
优先把 `sau` 作为主接口。
|
||||
|
||||
不要假设当前环境一定能读取仓库源码。
|
||||
不要一开始就去读 `uploader/`。
|
||||
只有在命令不可用或 CLI 执行失败时,才回退到故障排查说明。
|
||||
|
||||
## 功能概览
|
||||
|
||||
| 功能 | 命令入口 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| 抖音登录 | `sau douyin login --account <name>` | 生成或刷新指定账号的 cookie |
|
||||
| cookie 校验 | `sau douyin check --account <name>` | 检查指定账号 cookie 是否有效 |
|
||||
| 视频上传 | `sau douyin upload-video ...` | 上传并发布抖音视频 |
|
||||
| 图文上传 | `sau douyin upload-note ...` | 上传并发布抖音图文 |
|
||||
|
||||
元数据约定:
|
||||
|
||||
- 视频使用 `title + desc + tags`
|
||||
- 图文使用 `title + note + tags`
|
||||
|
||||
## 默认工作流
|
||||
|
||||
1. 先确认 `references/runtime-requirements.md` 里的运行前提。
|
||||
2. 再确认 `references/cli-contract.md` 里的命令契约。
|
||||
3. 执行匹配的 `sau douyin ...` 命令。
|
||||
4. 如果命令失败,再看 `references/troubleshooting.md`。
|
||||
|
||||
## 支持动作
|
||||
|
||||
- 使用 `sau douyin login --account <name>` 登录抖音
|
||||
- 使用 `sau douyin check --account <name>` 校验 cookie 是否有效
|
||||
- 使用 `sau douyin upload-video ...` 上传抖音视频
|
||||
- 使用 `sau douyin upload-note ...` 上传抖音图文
|
||||
|
||||
## 命令选择建议
|
||||
|
||||
- 当用户需要新的 cookie,或现有 cookie 已失效时,使用 `login`
|
||||
- 当用户只需要确认 cookie 状态时,使用 `check`
|
||||
- 当用户要发布视频时,使用 `upload-video`
|
||||
- 当用户要发布图文时,使用 `upload-note`
|
||||
|
||||
## 执行前检查
|
||||
|
||||
- 先确认当前 shell 里是否可以调用 `sau`
|
||||
- 如果 `sau` 不可用,按 `references/runtime-requirements.md` 里的回退方式处理
|
||||
- 当用户明确指定无头或有头模式时,显式传 `--headless` 或 `--headed`
|
||||
- 只有用户明确要求定时发布时,才使用 `--schedule`
|
||||
- 如果登录流程生成了本地二维码图片,不要只把图片路径告诉用户
|
||||
- 二维码图片本身就是给用户扫码的,优先直接把本地图片展示/发送给用户
|
||||
|
||||
## 模板文件
|
||||
|
||||
当你需要稳定的命令模板时,使用 `scripts/examples/` 下的文件:
|
||||
|
||||
- `douyin_commands.ps1`
|
||||
- `douyin_commands.sh`
|
||||
- `douyin_cli_template.py`
|
||||
|
||||
## 参考文档
|
||||
|
||||
- 运行前提:`references/runtime-requirements.md`
|
||||
- CLI 契约:`references/cli-contract.md`
|
||||
- 故障排查:`references/troubleshooting.md`
|
||||
109
vendor/social-auto-upload/skills/douyin-upload/references/cli-contract.md
vendored
Normal file
109
vendor/social-auto-upload/skills/douyin-upload/references/cli-contract.md
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
# 抖音 CLI 契约
|
||||
|
||||
这个 skill 默认假设当前环境已经安装并可调用 `sau` 命令。
|
||||
|
||||
## 命令列表
|
||||
|
||||
### 登录
|
||||
|
||||
```bash
|
||||
sau douyin login --account <account>
|
||||
```
|
||||
|
||||
- 必填参数:
|
||||
- `--account`
|
||||
- 作用:
|
||||
- 启动抖音登录流程,为指定账号生成或刷新 cookie 文件
|
||||
- 如果登录过程中生成本地二维码图片,agent 应优先直接把图片展示/发送给用户扫码,而不是只回传路径
|
||||
- 账号说明:
|
||||
- `--account` 传的是用户自定义的 `account_name`,不是固定只能叫 `creator`
|
||||
- 一个 `account_name` 对应一个账号文件,可用于多账号隔离和并发任务
|
||||
|
||||
### 校验 cookie
|
||||
|
||||
```bash
|
||||
sau douyin check --account <account>
|
||||
```
|
||||
|
||||
- 必填参数:
|
||||
- `--account`
|
||||
- 预期输出:
|
||||
- `valid`:cookie 可用
|
||||
- `invalid`:cookie 缺失或已失效
|
||||
|
||||
### 上传视频
|
||||
|
||||
```bash
|
||||
sau douyin upload-video \
|
||||
--account <account> \
|
||||
--file <video-path> \
|
||||
--title "<title>" \
|
||||
[--desc "<description>"] \
|
||||
[--tags tag1,tag2] \
|
||||
[--schedule "YYYY-MM-DD HH:MM"] \
|
||||
[--thumbnail <image-path>] \
|
||||
[--product-link <url>] \
|
||||
[--product-title "<title>"] \
|
||||
[--debug] \
|
||||
[--headless | --headed]
|
||||
```
|
||||
|
||||
- 必填参数:
|
||||
- `--account`
|
||||
- `--file`
|
||||
- `--title`
|
||||
- 可选参数:
|
||||
- `--desc`
|
||||
- `--tags`
|
||||
- `--schedule`
|
||||
- `--thumbnail`
|
||||
- `--product-link`
|
||||
- `--product-title`
|
||||
- `--debug`
|
||||
- `--headless`
|
||||
- `--headed`
|
||||
|
||||
### 上传图文
|
||||
|
||||
```bash
|
||||
sau douyin upload-note \
|
||||
--account <account> \
|
||||
--images <image-1> [image-2 ...] \
|
||||
--title "<title>" \
|
||||
[--note "<content>"] \
|
||||
[--tags tag1,tag2] \
|
||||
[--schedule "YYYY-MM-DD HH:MM"] \
|
||||
[--debug] \
|
||||
[--headless | --headed]
|
||||
```
|
||||
|
||||
- 必填参数:
|
||||
- `--account`
|
||||
- `--images`
|
||||
- `--title`
|
||||
- 可选参数:
|
||||
- `--note`
|
||||
- `--tags`
|
||||
- `--schedule`
|
||||
- `--debug`
|
||||
- `--headless`
|
||||
- `--headed`
|
||||
|
||||
## 发布策略
|
||||
|
||||
- 如果不传 `--schedule`,CLI 使用立即发布
|
||||
- 如果传了 `--schedule`,CLI 自动切换为定时发布
|
||||
- 时间格式为:
|
||||
|
||||
```text
|
||||
YYYY-MM-DD HH:MM
|
||||
```
|
||||
|
||||
## 额外说明
|
||||
|
||||
- `upload-video` 每次命令只支持一个视频文件
|
||||
- `upload-note` 每次命令支持多张图片
|
||||
- 视频描述字段统一使用 `--desc`
|
||||
- 图文正文统一使用 `--note`
|
||||
- `upload-note` 当前不支持 GIF
|
||||
- `upload-note` 当前最多支持 35 张图片
|
||||
67
vendor/social-auto-upload/skills/douyin-upload/references/runtime-requirements.md
vendored
Normal file
67
vendor/social-auto-upload/skills/douyin-upload/references/runtime-requirements.md
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
# 运行前提
|
||||
|
||||
这个 skill 默认假设当前环境已经具备:
|
||||
|
||||
- 已安装 `social-auto-upload`
|
||||
- 可以调用 `sau` 命令,或至少有等效调用方式
|
||||
- 已为 `patchright` 安装 Chromium
|
||||
|
||||
## 推荐安装方式
|
||||
|
||||
在项目根目录执行:
|
||||
|
||||
```bash
|
||||
uv pip install -e .
|
||||
```
|
||||
|
||||
## 安装 patchright 浏览器
|
||||
|
||||
Windows PowerShell:
|
||||
|
||||
```powershell
|
||||
$env:PLAYWRIGHT_DOWNLOAD_HOST="https://npmmirror.com/mirrors/playwright"; patchright install chromium
|
||||
```
|
||||
|
||||
Linux / macOS(bash / zsh):
|
||||
|
||||
```bash
|
||||
PLAYWRIGHT_DOWNLOAD_HOST="https://npmmirror.com/mirrors/playwright" patchright install chromium
|
||||
```
|
||||
|
||||
## 常见调用方式
|
||||
|
||||
### 如果 `sau` 已经在 PATH 中
|
||||
|
||||
```bash
|
||||
sau douyin --help
|
||||
```
|
||||
|
||||
### 如果虚拟环境存在,但还没有激活
|
||||
|
||||
PowerShell:
|
||||
|
||||
```powershell
|
||||
.\.venv\Scripts\Activate.ps1
|
||||
sau douyin --help
|
||||
```
|
||||
|
||||
### 如果你想直接调用可执行文件
|
||||
|
||||
PowerShell:
|
||||
|
||||
```powershell
|
||||
.\.venv\Scripts\sau.exe douyin --help
|
||||
```
|
||||
|
||||
### 如果你更倾向于使用 uv
|
||||
|
||||
```bash
|
||||
uv run sau douyin --help
|
||||
```
|
||||
|
||||
## 无头和有头模式
|
||||
|
||||
- 使用 `--headless` 表示无头模式
|
||||
- 使用 `--headed` 表示有头模式
|
||||
- 如果用户明确要求无头登录,也要预期 CLI 会通过控制台输出或临时图片路径提供二维码相关提示
|
||||
- 如果登录过程中已经生成了本地二维码图片,agent 应优先直接把图片展示/发送给用户扫码,不要只告诉用户图片路径
|
||||
87
vendor/social-auto-upload/skills/douyin-upload/references/troubleshooting.md
vendored
Normal file
87
vendor/social-auto-upload/skills/douyin-upload/references/troubleshooting.md
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
# 故障排查
|
||||
|
||||
## 找不到 `sau` 命令
|
||||
|
||||
可以尝试以下方式:
|
||||
|
||||
```powershell
|
||||
.\.venv\Scripts\Activate.ps1
|
||||
sau douyin --help
|
||||
```
|
||||
|
||||
```powershell
|
||||
.\.venv\Scripts\sau.exe douyin --help
|
||||
```
|
||||
|
||||
```bash
|
||||
uv run sau douyin --help
|
||||
```
|
||||
|
||||
如果当前环境还没有安装项目:
|
||||
|
||||
```bash
|
||||
uv pip install -e .
|
||||
```
|
||||
|
||||
## cookie 无效或已过期
|
||||
|
||||
先检查 cookie 状态:
|
||||
|
||||
```bash
|
||||
sau douyin check --account <account>
|
||||
```
|
||||
|
||||
如果无效,就重新登录:
|
||||
|
||||
```bash
|
||||
sau douyin login --account <account>
|
||||
```
|
||||
|
||||
## 无头登录二维码处理
|
||||
|
||||
如果用户无法使用终端二维码输出:
|
||||
|
||||
- 查找 CLI 打印出来的临时二维码图片
|
||||
- agent 不要只把图片路径回给用户
|
||||
- agent 应优先直接把本地二维码图片展示/发送给用户扫码
|
||||
|
||||
如果终端二维码显示不正常,优先使用保存下来的图片路径,而不是反复尝试随机的终端设置。
|
||||
|
||||
## 上传参数缺失
|
||||
|
||||
### 视频上传
|
||||
|
||||
最少需要:
|
||||
|
||||
- `--account`
|
||||
- `--file`
|
||||
- `--title`
|
||||
|
||||
### 图文上传
|
||||
|
||||
最少需要:
|
||||
|
||||
- `--account`
|
||||
- `--images`
|
||||
- `--title`
|
||||
|
||||
`--note` 当前是可选图文正文。
|
||||
|
||||
## 图片限制
|
||||
|
||||
对 `upload-note` 来说:
|
||||
|
||||
- 不支持 GIF
|
||||
- 最多 35 张图片
|
||||
|
||||
如果超出这些限制,先减少图片数量或替换文件格式,再重试。
|
||||
|
||||
## 定时发布
|
||||
|
||||
时间格式使用:
|
||||
|
||||
```text
|
||||
YYYY-MM-DD HH:MM
|
||||
```
|
||||
|
||||
如果不需要定时发布,去掉 `--schedule` 即可改为立即发布。
|
||||
62
vendor/social-auto-upload/skills/douyin-upload/scripts/examples/douyin_cli_template.py
vendored
Normal file
62
vendor/social-auto-upload/skills/douyin-upload/scripts/examples/douyin_cli_template.py
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import shlex
|
||||
import subprocess
|
||||
|
||||
|
||||
def run_command(command: list[str]) -> None:
|
||||
print("Running:", " ".join(shlex.quote(part) for part in command))
|
||||
subprocess.run(command, check=True)
|
||||
|
||||
|
||||
def main() -> None:
|
||||
account = "account_a"
|
||||
# account_name is user-defined. One account_name maps to one account file.
|
||||
# You can prepare multiple account names and run them in parallel.
|
||||
|
||||
commands = [
|
||||
["sau", "douyin", "login", "--account", account, "--headless"],
|
||||
["sau", "douyin", "check", "--account", account],
|
||||
[
|
||||
"sau",
|
||||
"douyin",
|
||||
"upload-video",
|
||||
"--account",
|
||||
account,
|
||||
"--file",
|
||||
"videos/demo.mp4",
|
||||
"--title",
|
||||
"Douyin video from Python",
|
||||
"--desc",
|
||||
"Douyin video description from Python",
|
||||
"--tags",
|
||||
"cli,video",
|
||||
"--thumbnail",
|
||||
"videos/demo.png",
|
||||
"--headless",
|
||||
],
|
||||
[
|
||||
"sau",
|
||||
"douyin",
|
||||
"upload-note",
|
||||
"--account",
|
||||
account,
|
||||
"--images",
|
||||
"videos/1.png",
|
||||
"videos/2.png",
|
||||
"--title",
|
||||
"Douyin note title from Python",
|
||||
"--note",
|
||||
"Douyin note from Python",
|
||||
"--tags",
|
||||
"cli,note",
|
||||
"--headless",
|
||||
],
|
||||
]
|
||||
|
||||
for command in commands:
|
||||
run_command(command)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
28
vendor/social-auto-upload/skills/douyin-upload/scripts/examples/douyin_commands.ps1
vendored
Normal file
28
vendor/social-auto-upload/skills/douyin-upload/scripts/examples/douyin_commands.ps1
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
# PowerShell examples for the installed sau CLI.
|
||||
|
||||
# account_name is user-defined. One account_name maps to one account file.
|
||||
# You can prepare multiple account names and run them in parallel.
|
||||
$account = "account_a"
|
||||
$video = "videos/demo.mp4"
|
||||
$thumbnail = "videos/demo.png"
|
||||
$noteImages = @("videos/1.png", "videos/2.png")
|
||||
|
||||
sau douyin login --account $account --headless
|
||||
sau douyin check --account $account
|
||||
|
||||
sau douyin upload-video `
|
||||
--account $account `
|
||||
--file $video `
|
||||
--title "Douyin video from PowerShell" `
|
||||
--desc "Douyin video description from PowerShell" `
|
||||
--tags "cli,video" `
|
||||
--thumbnail $thumbnail `
|
||||
--headless
|
||||
|
||||
sau douyin upload-note `
|
||||
--account $account `
|
||||
--images $noteImages `
|
||||
--title "Douyin note title from PowerShell" `
|
||||
--note "Douyin note from PowerShell" `
|
||||
--tags "cli,note" `
|
||||
--headless
|
||||
29
vendor/social-auto-upload/skills/douyin-upload/scripts/examples/douyin_commands.sh
vendored
Normal file
29
vendor/social-auto-upload/skills/douyin-upload/scripts/examples/douyin_commands.sh
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# account_name is user-defined. One account_name maps to one account file.
|
||||
# You can prepare multiple account names and run them in parallel.
|
||||
account="account_a"
|
||||
video="videos/demo.mp4"
|
||||
thumbnail="videos/demo.png"
|
||||
|
||||
sau douyin login --account "$account" --headless
|
||||
sau douyin check --account "$account"
|
||||
|
||||
sau douyin upload-video \
|
||||
--account "$account" \
|
||||
--file "$video" \
|
||||
--title "Douyin video from bash" \
|
||||
--desc "Douyin video description from bash" \
|
||||
--tags "cli,video" \
|
||||
--thumbnail "$thumbnail" \
|
||||
--headless
|
||||
|
||||
sau douyin upload-note \
|
||||
--account "$account" \
|
||||
--images "videos/1.png" "videos/2.png" \
|
||||
--title "Douyin note title from bash" \
|
||||
--note "Douyin note from bash" \
|
||||
--tags "cli,note" \
|
||||
--headless
|
||||
70
vendor/social-auto-upload/skills/kuaishou-upload/SKILL.md
vendored
Normal file
70
vendor/social-auto-upload/skills/kuaishou-upload/SKILL.md
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
---
|
||||
name: kuaishou-upload
|
||||
description: 当 agent 需要通过已安装的 `sau` CLI 完成快手登录、cookie 校验、视频上传或图文发布时使用这个 skill。该 skill 适用于已经安装 `social-auto-upload` 且可调用 `sau` 命令的环境。优先使用这个 skill 进行稳定的命令式快手工作流,而不是一开始就阅读 uploader 源码。
|
||||
---
|
||||
|
||||
# 快手上传 Skill
|
||||
|
||||
优先把 `sau` 作为主接口。
|
||||
|
||||
不要假设当前环境一定能读取仓库源码。
|
||||
不要一开始就去读 `uploader/`。
|
||||
只有在命令不可用或 CLI 执行失败时,才回退到故障排查说明。
|
||||
|
||||
## 功能概览
|
||||
|
||||
| 功能 | 命令入口 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| 快手登录 | `sau kuaishou login --account <name>` | 生成或刷新指定账号的 cookie |
|
||||
| cookie 校验 | `sau kuaishou check --account <name>` | 检查指定账号 cookie 是否有效 |
|
||||
| 视频上传 | `sau kuaishou upload-video ...` | 上传并发布快手视频 |
|
||||
| 图文上传 | `sau kuaishou upload-note ...` | 上传并发布快手图文 |
|
||||
|
||||
元数据约定:
|
||||
|
||||
- 视频使用 `title + desc + tags`
|
||||
- 图文使用 `title + note + tags`
|
||||
|
||||
## 默认工作流
|
||||
|
||||
1. 先确认 `references/runtime-requirements.md` 里的运行前提。
|
||||
2. 再确认 `references/cli-contract.md` 里的命令契约。
|
||||
3. 执行匹配的 `sau kuaishou ...` 命令。
|
||||
4. 如果命令失败,再看 `references/troubleshooting.md`。
|
||||
|
||||
## 支持动作
|
||||
|
||||
- 使用 `sau kuaishou login --account <name>` 登录快手
|
||||
- 使用 `sau kuaishou check --account <name>` 校验 cookie 是否有效
|
||||
- 使用 `sau kuaishou upload-video ...` 上传快手视频
|
||||
- 使用 `sau kuaishou upload-note ...` 上传快手图文
|
||||
|
||||
## 命令选择建议
|
||||
|
||||
- 当用户需要新的 cookie,或现有 cookie 已失效时,使用 `login`
|
||||
- 当用户只需要确认 cookie 状态时,使用 `check`
|
||||
- 当用户要发布视频时,使用 `upload-video`
|
||||
- 当用户要发布图文时,使用 `upload-note`
|
||||
|
||||
## 执行前检查
|
||||
|
||||
- 先确认当前 shell 里是否可以调用 `sau`
|
||||
- 如果 `sau` 不可用,按 `references/runtime-requirements.md` 里的回退方式处理
|
||||
- 当用户明确指定无头或有头模式时,显式传 `--headless` 或 `--headed`
|
||||
- 只有用户明确要求定时发布时,才使用 `--schedule`
|
||||
- 如果登录流程生成了本地二维码图片,不要只把图片路径告诉用户
|
||||
- 二维码图片本身就是给用户扫码的,优先直接把本地图片展示/发送给用户
|
||||
|
||||
## 模板文件
|
||||
|
||||
当你需要稳定的命令模板时,使用 `scripts/examples/` 下的文件:
|
||||
|
||||
- `kuaishou_commands.ps1`
|
||||
- `kuaishou_commands.sh`
|
||||
- `kuaishou_cli_template.py`
|
||||
|
||||
## 参考文档
|
||||
|
||||
- 运行前提:`references/runtime-requirements.md`
|
||||
- CLI 契约:`references/cli-contract.md`
|
||||
- 故障排查:`references/troubleshooting.md`
|
||||
104
vendor/social-auto-upload/skills/kuaishou-upload/references/cli-contract.md
vendored
Normal file
104
vendor/social-auto-upload/skills/kuaishou-upload/references/cli-contract.md
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
# 快手 CLI 契约
|
||||
|
||||
这个 skill 默认假设当前环境已经安装并可调用 `sau` 命令。
|
||||
|
||||
## 命令列表
|
||||
|
||||
### 登录
|
||||
|
||||
```bash
|
||||
sau kuaishou login --account <account>
|
||||
```
|
||||
|
||||
- 必填参数:
|
||||
- `--account`
|
||||
- 作用:
|
||||
- 启动快手登录流程,为指定账号生成或刷新 cookie 文件
|
||||
- 如果登录过程中生成本地二维码图片,agent 应优先直接把图片展示/发送给用户扫码,而不是只回传路径
|
||||
- 账号说明:
|
||||
- `--account` 传的是用户自定义的 `account_name`,不是固定只能叫 `creator`
|
||||
- 一个 `account_name` 对应一个账号文件,可用于多账号隔离和并发任务
|
||||
|
||||
### 校验 cookie
|
||||
|
||||
```bash
|
||||
sau kuaishou check --account <account>
|
||||
```
|
||||
|
||||
- 必填参数:
|
||||
- `--account`
|
||||
- 预期输出:
|
||||
- `valid`:cookie 可用
|
||||
- `invalid`:cookie 缺失或已失效
|
||||
|
||||
### 上传视频
|
||||
|
||||
```bash
|
||||
sau kuaishou upload-video \
|
||||
--account <account> \
|
||||
--file <video-path> \
|
||||
--title "<title>" \
|
||||
[--desc "<description>"] \
|
||||
[--tags tag1,tag2] \
|
||||
[--schedule "YYYY-MM-DD HH:MM"] \
|
||||
[--thumbnail <image-path>] \
|
||||
[--debug] \
|
||||
[--headless | --headed]
|
||||
```
|
||||
|
||||
- 必填参数:
|
||||
- `--account`
|
||||
- `--file`
|
||||
- `--title`
|
||||
- 可选参数:
|
||||
- `--desc`
|
||||
- `--tags`
|
||||
- `--schedule`
|
||||
- `--thumbnail`
|
||||
- `--debug`
|
||||
- `--headless`
|
||||
- `--headed`
|
||||
|
||||
### 上传图文
|
||||
|
||||
```bash
|
||||
sau kuaishou upload-note \
|
||||
--account <account> \
|
||||
--images <image-1> [image-2 ...] \
|
||||
--title "<title>" \
|
||||
[--note "<content>"] \
|
||||
[--tags tag1,tag2] \
|
||||
[--schedule "YYYY-MM-DD HH:MM"] \
|
||||
[--debug] \
|
||||
[--headless | --headed]
|
||||
```
|
||||
|
||||
- 必填参数:
|
||||
- `--account`
|
||||
- `--images`
|
||||
- `--title`
|
||||
- 可选参数:
|
||||
- `--note`
|
||||
- `--tags`
|
||||
- `--schedule`
|
||||
- `--debug`
|
||||
- `--headless`
|
||||
- `--headed`
|
||||
|
||||
## 发布策略
|
||||
|
||||
- 如果不传 `--schedule`,CLI 使用立即发布
|
||||
- 如果传了 `--schedule`,CLI 自动切换为定时发布
|
||||
- 时间格式为:
|
||||
|
||||
```text
|
||||
YYYY-MM-DD HH:MM
|
||||
```
|
||||
|
||||
## 额外说明
|
||||
|
||||
- `upload-video` 每次命令只支持一个视频文件
|
||||
- `upload-note` 每次命令支持多张图片
|
||||
- 视频描述字段统一使用 `--desc`
|
||||
- 图文正文统一使用 `--note`
|
||||
- `upload-note` 当前要求传入真实的多张图片文件,而不是同一路径重复多次
|
||||
68
vendor/social-auto-upload/skills/kuaishou-upload/references/runtime-requirements.md
vendored
Normal file
68
vendor/social-auto-upload/skills/kuaishou-upload/references/runtime-requirements.md
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
# 运行前提
|
||||
|
||||
这个 skill 默认假设当前环境已经具备:
|
||||
|
||||
- 已安装 `social-auto-upload`
|
||||
- 可以调用 `sau` 命令,或至少有等效调用方式
|
||||
- 已为 `patchright` 安装 Chromium
|
||||
|
||||
## 推荐安装方式
|
||||
|
||||
在项目根目录执行:
|
||||
|
||||
```bash
|
||||
uv pip install -e .
|
||||
```
|
||||
|
||||
## 安装 patchright 浏览器
|
||||
|
||||
Windows PowerShell:
|
||||
|
||||
```powershell
|
||||
$env:PLAYWRIGHT_DOWNLOAD_HOST="https://npmmirror.com/mirrors/playwright"; patchright install chromium
|
||||
```
|
||||
|
||||
Linux / macOS(bash / zsh):
|
||||
|
||||
```bash
|
||||
PLAYWRIGHT_DOWNLOAD_HOST="https://npmmirror.com/mirrors/playwright" patchright install chromium
|
||||
```
|
||||
|
||||
## 常见调用方式
|
||||
|
||||
### 如果 `sau` 已经在 PATH 中
|
||||
|
||||
```bash
|
||||
sau kuaishou --help
|
||||
```
|
||||
|
||||
### 如果虚拟环境存在,但还没有激活
|
||||
|
||||
PowerShell:
|
||||
|
||||
```powershell
|
||||
.\.venv\Scripts\Activate.ps1
|
||||
sau kuaishou --help
|
||||
```
|
||||
|
||||
### 如果你想直接调用可执行文件
|
||||
|
||||
PowerShell:
|
||||
|
||||
```powershell
|
||||
.\.venv\Scripts\sau.exe kuaishou --help
|
||||
```
|
||||
|
||||
### 如果你更倾向于使用 uv
|
||||
|
||||
```bash
|
||||
uv run sau kuaishou --help
|
||||
```
|
||||
|
||||
## 无头和有头模式
|
||||
|
||||
- 使用 `--headless` 表示无头模式
|
||||
- 使用 `--headed` 表示有头模式
|
||||
- 快手 CLI 默认按无头模式运行
|
||||
- 如果用户明确要求可见浏览器窗口,或二维码展示确实有问题,再切到 `--headed`
|
||||
- 如果登录过程中已经生成了本地二维码图片,agent 应优先直接把图片展示/发送给用户扫码,不要只告诉用户图片路径
|
||||
85
vendor/social-auto-upload/skills/kuaishou-upload/references/troubleshooting.md
vendored
Normal file
85
vendor/social-auto-upload/skills/kuaishou-upload/references/troubleshooting.md
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
# 故障排查
|
||||
|
||||
## 找不到 `sau` 命令
|
||||
|
||||
可以尝试以下方式:
|
||||
|
||||
```powershell
|
||||
.\.venv\Scripts\Activate.ps1
|
||||
sau kuaishou --help
|
||||
```
|
||||
|
||||
```powershell
|
||||
.\.venv\Scripts\sau.exe kuaishou --help
|
||||
```
|
||||
|
||||
```bash
|
||||
uv run sau kuaishou --help
|
||||
```
|
||||
|
||||
如果当前环境还没有安装项目:
|
||||
|
||||
```bash
|
||||
uv pip install -e .
|
||||
```
|
||||
|
||||
## cookie 无效或已过期
|
||||
|
||||
先检查 cookie 状态:
|
||||
|
||||
```bash
|
||||
sau kuaishou check --account <account>
|
||||
```
|
||||
|
||||
如果无效,就重新登录:
|
||||
|
||||
```bash
|
||||
sau kuaishou login --account <account>
|
||||
```
|
||||
|
||||
## 登录二维码问题
|
||||
|
||||
如果用户反馈二维码在终端里不好扫:
|
||||
|
||||
- 先优先使用 CLI / uploader 生成的本地二维码图片
|
||||
- 只有用户明确需要可见浏览器窗口,或图片方案仍然不方便时,再切到 `--headed`
|
||||
- 如果 CLI / uploader 已经生成临时二维码图片,agent 不要只回图片路径
|
||||
- agent 应优先直接把本地二维码图片展示/发送给用户扫码
|
||||
- 图片路径只作为补充信息
|
||||
|
||||
## 上传参数缺失
|
||||
|
||||
### 视频上传
|
||||
|
||||
最少需要:
|
||||
|
||||
- `--account`
|
||||
- `--file`
|
||||
- `--title`
|
||||
|
||||
### 图文上传
|
||||
|
||||
最少需要:
|
||||
|
||||
- `--account`
|
||||
- `--images`
|
||||
- `--title`
|
||||
|
||||
`--note` 当前是可选图文正文。
|
||||
|
||||
## 图文上传只有一张生效
|
||||
|
||||
如果用户一次传了多张图片,但页面只识别到一张,先确认:
|
||||
|
||||
- `--images` 里传的是不是真正不同的文件
|
||||
- 不是同一路径重复多次
|
||||
|
||||
## 定时发布
|
||||
|
||||
时间格式使用:
|
||||
|
||||
```text
|
||||
YYYY-MM-DD HH:MM
|
||||
```
|
||||
|
||||
如果不需要定时发布,去掉 `--schedule` 即可改为立即发布。
|
||||
63
vendor/social-auto-upload/skills/kuaishou-upload/scripts/examples/kuaishou_cli_template.py
vendored
Normal file
63
vendor/social-auto-upload/skills/kuaishou-upload/scripts/examples/kuaishou_cli_template.py
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import shlex
|
||||
import subprocess
|
||||
|
||||
|
||||
def run_command(command: list[str]) -> None:
|
||||
print("Running:", " ".join(shlex.quote(part) for part in command))
|
||||
subprocess.run(command, check=True)
|
||||
|
||||
|
||||
def main() -> None:
|
||||
account = "account_a"
|
||||
# account_name is user-defined. One account_name maps to one account file.
|
||||
# You can prepare multiple account names and run them in parallel.
|
||||
|
||||
commands = [
|
||||
["sau", "kuaishou", "login", "--account", account],
|
||||
["sau", "kuaishou", "check", "--account", account],
|
||||
[
|
||||
"sau",
|
||||
"kuaishou",
|
||||
"upload-video",
|
||||
"--account",
|
||||
account,
|
||||
"--file",
|
||||
"videos/demo.mp4",
|
||||
"--title",
|
||||
"Kuaishou video from Python",
|
||||
"--desc",
|
||||
"Kuaishou video description from Python",
|
||||
"--tags",
|
||||
"cli,video",
|
||||
"--thumbnail",
|
||||
"videos/demo.png",
|
||||
"--headless",
|
||||
],
|
||||
[
|
||||
"sau",
|
||||
"kuaishou",
|
||||
"upload-note",
|
||||
"--account",
|
||||
account,
|
||||
"--images",
|
||||
"videos/1.png",
|
||||
"videos/2.png",
|
||||
"videos/3.png",
|
||||
"--title",
|
||||
"Kuaishou note title from Python",
|
||||
"--note",
|
||||
"Kuaishou note from Python",
|
||||
"--tags",
|
||||
"cli,note",
|
||||
"--headless",
|
||||
],
|
||||
]
|
||||
|
||||
for command in commands:
|
||||
run_command(command)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
28
vendor/social-auto-upload/skills/kuaishou-upload/scripts/examples/kuaishou_commands.ps1
vendored
Normal file
28
vendor/social-auto-upload/skills/kuaishou-upload/scripts/examples/kuaishou_commands.ps1
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
# PowerShell examples for the installed sau CLI.
|
||||
|
||||
# account_name is user-defined. One account_name maps to one account file.
|
||||
# You can prepare multiple account names and run them in parallel.
|
||||
$account = "account_a"
|
||||
$video = "videos/demo.mp4"
|
||||
$thumbnail = "videos/demo.png"
|
||||
$noteImages = @("videos/1.png", "videos/2.png", "videos/3.png")
|
||||
|
||||
sau kuaishou login --account $account
|
||||
sau kuaishou check --account $account
|
||||
|
||||
sau kuaishou upload-video `
|
||||
--account $account `
|
||||
--file $video `
|
||||
--title "Kuaishou video from PowerShell" `
|
||||
--desc "Kuaishou video description from PowerShell" `
|
||||
--tags "cli,video" `
|
||||
--thumbnail $thumbnail `
|
||||
--headless
|
||||
|
||||
sau kuaishou upload-note `
|
||||
--account $account `
|
||||
--images $noteImages `
|
||||
--title "Kuaishou note title from PowerShell" `
|
||||
--note "Kuaishou note from PowerShell" `
|
||||
--tags "cli,note" `
|
||||
--headless
|
||||
29
vendor/social-auto-upload/skills/kuaishou-upload/scripts/examples/kuaishou_commands.sh
vendored
Normal file
29
vendor/social-auto-upload/skills/kuaishou-upload/scripts/examples/kuaishou_commands.sh
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# account_name is user-defined. One account_name maps to one account file.
|
||||
# You can prepare multiple account names and run them in parallel.
|
||||
account="account_a"
|
||||
video="videos/demo.mp4"
|
||||
thumbnail="videos/demo.png"
|
||||
|
||||
sau kuaishou login --account "$account"
|
||||
sau kuaishou check --account "$account"
|
||||
|
||||
sau kuaishou upload-video \
|
||||
--account "$account" \
|
||||
--file "$video" \
|
||||
--title "Kuaishou video from bash" \
|
||||
--desc "Kuaishou video description from bash" \
|
||||
--tags "cli,video" \
|
||||
--thumbnail "$thumbnail" \
|
||||
--headless
|
||||
|
||||
sau kuaishou upload-note \
|
||||
--account "$account" \
|
||||
--images "videos/1.png" "videos/2.png" "videos/3.png" \
|
||||
--title "Kuaishou note title from bash" \
|
||||
--note "Kuaishou note from bash" \
|
||||
--tags "cli,note" \
|
||||
--headless
|
||||
70
vendor/social-auto-upload/skills/xiaohongshu-upload/SKILL.md
vendored
Normal file
70
vendor/social-auto-upload/skills/xiaohongshu-upload/SKILL.md
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
---
|
||||
name: xiaohongshu-upload
|
||||
description: 当 agent 需要通过已安装的 `sau` CLI 完成小红书登录、cookie 校验、视频上传或图文发布时使用这个 skill。该 skill 适用于已经安装 `social-auto-upload` 且可调用 `sau` 命令的环境。优先使用这个 skill 进行稳定的命令式小红书工作流,而不是一开始就阅读 uploader 源码。
|
||||
---
|
||||
|
||||
# 小红书上传 Skill
|
||||
|
||||
优先把 `sau` 作为主接口。
|
||||
|
||||
不要假设当前环境一定能读取仓库源码。
|
||||
不要一开始就去读 `uploader/`。
|
||||
只有在命令不可用或 CLI 执行失败时,才回退到故障排查说明。
|
||||
|
||||
## 功能概览
|
||||
|
||||
| 功能 | 命令入口 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| 小红书登录 | `sau xiaohongshu login --account <name>` | 生成或刷新指定账号的 cookie |
|
||||
| cookie 校验 | `sau xiaohongshu check --account <name>` | 检查指定账号 cookie 是否有效 |
|
||||
| 视频上传 | `sau xiaohongshu upload-video ...` | 上传并发布小红书视频 |
|
||||
| 图文上传 | `sau xiaohongshu upload-note ...` | 上传并发布小红书图文 |
|
||||
|
||||
元数据约定:
|
||||
|
||||
- 视频使用 `title + desc + tags`
|
||||
- 图文使用 `title + note + tags`
|
||||
|
||||
## 默认工作流
|
||||
|
||||
1. 先确认 `references/runtime-requirements.md` 里的运行前提。
|
||||
2. 再确认 `references/cli-contract.md` 里的命令契约。
|
||||
3. 执行匹配的 `sau xiaohongshu ...` 命令。
|
||||
4. 如果命令失败,再看 `references/troubleshooting.md`。
|
||||
|
||||
## 支持动作
|
||||
|
||||
- 使用 `sau xiaohongshu login --account <name>` 登录小红书
|
||||
- 使用 `sau xiaohongshu check --account <name>` 校验 cookie 是否有效
|
||||
- 使用 `sau xiaohongshu upload-video ...` 上传小红书视频
|
||||
- 使用 `sau xiaohongshu upload-note ...` 上传小红书图文
|
||||
|
||||
## 命令选择建议
|
||||
|
||||
- 当用户需要新的 cookie,或现有 cookie 已失效时,使用 `login`
|
||||
- 当用户只需要确认 cookie 状态时,使用 `check`
|
||||
- 当用户要发布视频时,使用 `upload-video`
|
||||
- 当用户要发布图文时,使用 `upload-note`
|
||||
|
||||
## 执行前检查
|
||||
|
||||
- 先确认当前 shell 里是否可以调用 `sau`
|
||||
- 如果 `sau` 不可用,按 `references/runtime-requirements.md` 里的回退方式处理
|
||||
- 当用户明确指定无头或有头模式时,显式传 `--headless` 或 `--headed`
|
||||
- 只有用户明确要求定时发布时,才使用 `--schedule`
|
||||
- 如果登录流程生成了本地二维码图片,不要只把图片路径告诉用户
|
||||
- 二维码图片本身就是给用户扫码的,优先直接把本地图片展示/发送给用户
|
||||
|
||||
## 模板文件
|
||||
|
||||
当你需要稳定的命令模板时,使用 `scripts/examples/` 下的文件:
|
||||
|
||||
- `xiaohongshu_commands.ps1`
|
||||
- `xiaohongshu_commands.sh`
|
||||
- `xiaohongshu_cli_template.py`
|
||||
|
||||
## 参考文档
|
||||
|
||||
- 运行前提:`references/runtime-requirements.md`
|
||||
- CLI 契约:`references/cli-contract.md`
|
||||
- 故障排查:`references/troubleshooting.md`
|
||||
103
vendor/social-auto-upload/skills/xiaohongshu-upload/references/cli-contract.md
vendored
Normal file
103
vendor/social-auto-upload/skills/xiaohongshu-upload/references/cli-contract.md
vendored
Normal file
@@ -0,0 +1,103 @@
|
||||
# 小红书 CLI 契约
|
||||
|
||||
这个 skill 默认假设当前环境已经安装并可调用 `sau` 命令。
|
||||
|
||||
## 命令列表
|
||||
|
||||
### 登录
|
||||
|
||||
```bash
|
||||
sau xiaohongshu login --account <account>
|
||||
```
|
||||
|
||||
- 必填参数:
|
||||
- `--account`
|
||||
- 作用:
|
||||
- 启动小红书登录流程,为指定账号生成或刷新 cookie 文件
|
||||
- 如果登录过程中生成本地二维码图片,agent 应优先直接把图片展示/发送给用户扫码,而不是只回传路径
|
||||
- 账号说明:
|
||||
- `--account` 传的是用户自定义的 `account_name`,不是固定只能叫 `creator`
|
||||
- 一个 `account_name` 对应一个账号文件,可用于多账号隔离和并发任务
|
||||
|
||||
### 校验 cookie
|
||||
|
||||
```bash
|
||||
sau xiaohongshu check --account <account>
|
||||
```
|
||||
|
||||
- 必填参数:
|
||||
- `--account`
|
||||
- 预期输出:
|
||||
- `valid`:cookie 可用
|
||||
- `invalid`:cookie 缺失或已失效
|
||||
|
||||
### 上传视频
|
||||
|
||||
```bash
|
||||
sau xiaohongshu upload-video \
|
||||
--account <account> \
|
||||
--file <video-path> \
|
||||
--title "<title>" \
|
||||
[--desc "<description>"] \
|
||||
[--tags tag1,tag2] \
|
||||
[--schedule "YYYY-MM-DD HH:MM"] \
|
||||
[--thumbnail <image-path>] \
|
||||
[--debug] \
|
||||
[--headless | --headed]
|
||||
```
|
||||
|
||||
- 必填参数:
|
||||
- `--account`
|
||||
- `--file`
|
||||
- `--title`
|
||||
- 可选参数:
|
||||
- `--desc`
|
||||
- `--tags`
|
||||
- `--schedule`
|
||||
- `--thumbnail`
|
||||
- `--debug`
|
||||
- `--headless`
|
||||
- `--headed`
|
||||
|
||||
### 上传图文
|
||||
|
||||
```bash
|
||||
sau xiaohongshu upload-note \
|
||||
--account <account> \
|
||||
--images <image-1> [image-2 ...] \
|
||||
--title "<title>" \
|
||||
[--note "<content>"] \
|
||||
[--tags tag1,tag2] \
|
||||
[--schedule "YYYY-MM-DD HH:MM"] \
|
||||
[--debug] \
|
||||
[--headless | --headed]
|
||||
```
|
||||
|
||||
- 必填参数:
|
||||
- `--account`
|
||||
- `--images`
|
||||
- `--title`
|
||||
- 可选参数:
|
||||
- `--note`
|
||||
- `--tags`
|
||||
- `--schedule`
|
||||
- `--debug`
|
||||
- `--headless`
|
||||
- `--headed`
|
||||
|
||||
## 发布策略
|
||||
|
||||
- 如果不传 `--schedule`,CLI 使用立即发布
|
||||
- 如果传了 `--schedule`,CLI 自动切换为定时发布
|
||||
- 时间格式为:
|
||||
|
||||
```text
|
||||
YYYY-MM-DD HH:MM
|
||||
```
|
||||
|
||||
## 额外说明
|
||||
|
||||
- `upload-video` 每次命令只支持一个视频文件
|
||||
- `upload-note` 每次命令支持多张图片
|
||||
- 视频描述字段统一使用 `--desc`
|
||||
- 图文正文统一使用 `--note`
|
||||
67
vendor/social-auto-upload/skills/xiaohongshu-upload/references/runtime-requirements.md
vendored
Normal file
67
vendor/social-auto-upload/skills/xiaohongshu-upload/references/runtime-requirements.md
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
# 运行前提
|
||||
|
||||
这个 skill 默认假设当前环境已经具备:
|
||||
|
||||
- 已安装 `social-auto-upload`
|
||||
- 可以调用 `sau` 命令,或至少有等效调用方式
|
||||
- 已为 `patchright` 安装 Chromium
|
||||
|
||||
## 推荐安装方式
|
||||
|
||||
在项目根目录执行:
|
||||
|
||||
```bash
|
||||
uv pip install -e .
|
||||
```
|
||||
|
||||
## 安装 patchright 浏览器
|
||||
|
||||
Windows PowerShell:
|
||||
|
||||
```powershell
|
||||
$env:PLAYWRIGHT_DOWNLOAD_HOST="https://npmmirror.com/mirrors/playwright"; patchright install chromium
|
||||
```
|
||||
|
||||
Linux / macOS(bash / zsh):
|
||||
|
||||
```bash
|
||||
PLAYWRIGHT_DOWNLOAD_HOST="https://npmmirror.com/mirrors/playwright" patchright install chromium
|
||||
```
|
||||
|
||||
## 常见调用方式
|
||||
|
||||
### 如果 `sau` 已经在 PATH 中
|
||||
|
||||
```bash
|
||||
sau xiaohongshu --help
|
||||
```
|
||||
|
||||
### 如果虚拟环境存在,但还没有激活
|
||||
|
||||
PowerShell:
|
||||
|
||||
```powershell
|
||||
.\.venv\Scripts\Activate.ps1
|
||||
sau xiaohongshu --help
|
||||
```
|
||||
|
||||
### 如果你想直接调用可执行文件
|
||||
|
||||
PowerShell:
|
||||
|
||||
```powershell
|
||||
.\.venv\Scripts\sau.exe xiaohongshu --help
|
||||
```
|
||||
|
||||
### 如果你更倾向于使用 uv
|
||||
|
||||
```bash
|
||||
uv run sau xiaohongshu --help
|
||||
```
|
||||
|
||||
## 无头和有头模式
|
||||
|
||||
- 使用 `--headless` 表示无头模式
|
||||
- 使用 `--headed` 表示有头模式
|
||||
- 如果用户明确要求无头登录,也要预期 CLI 会通过控制台输出或临时图片路径提供二维码相关提示
|
||||
- 如果登录过程中已经生成了本地二维码图片,agent 应优先直接把图片展示/发送给用户扫码,不要只告诉用户图片路径
|
||||
78
vendor/social-auto-upload/skills/xiaohongshu-upload/references/troubleshooting.md
vendored
Normal file
78
vendor/social-auto-upload/skills/xiaohongshu-upload/references/troubleshooting.md
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
# 故障排查
|
||||
|
||||
## 找不到 `sau` 命令
|
||||
|
||||
可以尝试以下方式:
|
||||
|
||||
```powershell
|
||||
.\.venv\Scripts\Activate.ps1
|
||||
sau xiaohongshu --help
|
||||
```
|
||||
|
||||
```powershell
|
||||
.\.venv\Scripts\sau.exe xiaohongshu --help
|
||||
```
|
||||
|
||||
```bash
|
||||
uv run sau xiaohongshu --help
|
||||
```
|
||||
|
||||
如果当前环境还没有安装项目:
|
||||
|
||||
```bash
|
||||
uv pip install -e .
|
||||
```
|
||||
|
||||
## cookie 无效或已过期
|
||||
|
||||
先检查 cookie 状态:
|
||||
|
||||
```bash
|
||||
sau xiaohongshu check --account <account>
|
||||
```
|
||||
|
||||
如果无效,就重新登录:
|
||||
|
||||
```bash
|
||||
sau xiaohongshu login --account <account>
|
||||
```
|
||||
|
||||
## 无头登录二维码处理
|
||||
|
||||
如果用户无法使用终端二维码输出:
|
||||
|
||||
- 查找 CLI 打印出来的临时二维码图片
|
||||
- agent 不要只把图片路径回给用户
|
||||
- agent 应优先直接把本地二维码图片展示/发送给用户扫码
|
||||
|
||||
如果终端二维码显示不正常,优先使用保存下来的图片路径,而不是反复尝试随机的终端设置。
|
||||
|
||||
## 上传参数缺失
|
||||
|
||||
### 视频上传
|
||||
|
||||
最少需要:
|
||||
|
||||
- `--account`
|
||||
- `--file`
|
||||
- `--title`
|
||||
|
||||
### 图文上传
|
||||
|
||||
最少需要:
|
||||
|
||||
- `--account`
|
||||
- `--images`
|
||||
- `--title`
|
||||
|
||||
`--note` 当前是可选图文正文。
|
||||
|
||||
## 定时发布
|
||||
|
||||
时间格式使用:
|
||||
|
||||
```text
|
||||
YYYY-MM-DD HH:MM
|
||||
```
|
||||
|
||||
如果不需要定时发布,去掉 `--schedule` 即可改为立即发布。
|
||||
62
vendor/social-auto-upload/skills/xiaohongshu-upload/scripts/examples/xiaohongshu_cli_template.py
vendored
Normal file
62
vendor/social-auto-upload/skills/xiaohongshu-upload/scripts/examples/xiaohongshu_cli_template.py
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import shlex
|
||||
import subprocess
|
||||
|
||||
|
||||
def run_command(command: list[str]) -> None:
|
||||
print("Running:", " ".join(shlex.quote(part) for part in command))
|
||||
subprocess.run(command, check=True)
|
||||
|
||||
|
||||
def main() -> None:
|
||||
account = "account_a"
|
||||
# account_name is user-defined. One account_name maps to one account file.
|
||||
# You can prepare multiple account names and run them in parallel.
|
||||
|
||||
commands = [
|
||||
["sau", "xiaohongshu", "login", "--account", account, "--headless"],
|
||||
["sau", "xiaohongshu", "check", "--account", account],
|
||||
[
|
||||
"sau",
|
||||
"xiaohongshu",
|
||||
"upload-video",
|
||||
"--account",
|
||||
account,
|
||||
"--file",
|
||||
"videos/demo.mp4",
|
||||
"--title",
|
||||
"Xiaohongshu video from Python",
|
||||
"--desc",
|
||||
"Xiaohongshu video description from Python",
|
||||
"--tags",
|
||||
"cli,video",
|
||||
"--thumbnail",
|
||||
"videos/demo.png",
|
||||
"--headless",
|
||||
],
|
||||
[
|
||||
"sau",
|
||||
"xiaohongshu",
|
||||
"upload-note",
|
||||
"--account",
|
||||
account,
|
||||
"--images",
|
||||
"videos/1.png",
|
||||
"videos/2.png",
|
||||
"--title",
|
||||
"Xiaohongshu note title from Python",
|
||||
"--note",
|
||||
"Xiaohongshu note from Python",
|
||||
"--tags",
|
||||
"cli,note",
|
||||
"--headless",
|
||||
],
|
||||
]
|
||||
|
||||
for command in commands:
|
||||
run_command(command)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
28
vendor/social-auto-upload/skills/xiaohongshu-upload/scripts/examples/xiaohongshu_commands.ps1
vendored
Normal file
28
vendor/social-auto-upload/skills/xiaohongshu-upload/scripts/examples/xiaohongshu_commands.ps1
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
# PowerShell examples for the installed sau CLI.
|
||||
|
||||
# account_name is user-defined. One account_name maps to one account file.
|
||||
# You can prepare multiple account names and run them in parallel.
|
||||
$account = "account_a"
|
||||
$video = "videos/demo.mp4"
|
||||
$thumbnail = "videos/demo.png"
|
||||
$noteImages = @("videos/1.png", "videos/2.png")
|
||||
|
||||
sau xiaohongshu login --account $account --headless
|
||||
sau xiaohongshu check --account $account
|
||||
|
||||
sau xiaohongshu upload-video `
|
||||
--account $account `
|
||||
--file $video `
|
||||
--title "Xiaohongshu video from PowerShell" `
|
||||
--desc "Xiaohongshu video description from PowerShell" `
|
||||
--tags "cli,video" `
|
||||
--thumbnail $thumbnail `
|
||||
--headless
|
||||
|
||||
sau xiaohongshu upload-note `
|
||||
--account $account `
|
||||
--images $noteImages `
|
||||
--title "Xiaohongshu note title from PowerShell" `
|
||||
--note "Xiaohongshu note from PowerShell" `
|
||||
--tags "cli,note" `
|
||||
--headless
|
||||
29
vendor/social-auto-upload/skills/xiaohongshu-upload/scripts/examples/xiaohongshu_commands.sh
vendored
Normal file
29
vendor/social-auto-upload/skills/xiaohongshu-upload/scripts/examples/xiaohongshu_commands.sh
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# account_name is user-defined. One account_name maps to one account file.
|
||||
# You can prepare multiple account names and run them in parallel.
|
||||
account="account_a"
|
||||
video="videos/demo.mp4"
|
||||
thumbnail="videos/demo.png"
|
||||
|
||||
sau xiaohongshu login --account "$account" --headless
|
||||
sau xiaohongshu check --account "$account"
|
||||
|
||||
sau xiaohongshu upload-video \
|
||||
--account "$account" \
|
||||
--file "$video" \
|
||||
--title "Xiaohongshu video from bash" \
|
||||
--desc "Xiaohongshu video description from bash" \
|
||||
--tags "cli,video" \
|
||||
--thumbnail "$thumbnail" \
|
||||
--headless
|
||||
|
||||
sau xiaohongshu upload-note \
|
||||
--account "$account" \
|
||||
--images "videos/1.png" "videos/2.png" \
|
||||
--title "Xiaohongshu note title from bash" \
|
||||
--note "Xiaohongshu note from bash" \
|
||||
--tags "cli,note" \
|
||||
--headless
|
||||
Reference in New Issue
Block a user