50 lines
1.2 KiB
Markdown
50 lines
1.2 KiB
Markdown
# scripts 目录说明
|
||||
|
|
|
|||
|
|
辅助脚本清单与用法。
|
|||
|
|
|
|||
|
|
## check_env.py
|
|||
|
|
|
|||
|
|
投放环境检查:POSTIZ_API_KEY、sau 命令、Python 版本、requests 库。
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
python check_env.py
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
返回码:0=双通道就绪,1=有缺失项。投放流程步骤 3 开始时运行。
|
|||
|
|
|
|||
|
|
## postiz_client.py
|
|||
|
|
|
|||
|
|
Postiz REST API 封装(标准库 + requests),用于海外投放:
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
# 列出已连接渠道(取 integration id)
|
|||
|
|
python postiz_client.py integrations
|
|||
|
|
|
|||
|
|
# 上传视频文件(返回 URL)
|
|||
|
|
python postiz_client.py upload D:/videos/demo.mp4
|
|||
|
|
|
|||
|
|
# 创建/排期/发布(请求体为 JSON 文件)
|
|||
|
|
python postiz_client.py posts post_body.json
|
|||
|
|
|
|||
|
|
# 查询时间段内帖子
|
|||
|
|
python postiz_client.py query 2026-08-30T00:00:00.000Z 2026-08-31T00:00:00.000Z
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
**凭证**:环境变量 `POSTIZ_API_KEY`(必填),`POSTIZ_API_BASE` 可覆盖(自托管实例)。
|
|||
|
|
|
|||
|
|
post_body.json 示例:
|
|||
|
|
|
|||
|
|
```json
|
|||
|
|
{
|
|||
|
|
"type": "now",
|
|||
|
|
"posts": [
|
|||
|
|
{
|
|||
|
|
"integration": {"id": "yt-integration-id"},
|
|||
|
|
"value": [{"content": "视频简介", "image": []}],
|
|||
|
|
"settings": {"__type": "youtube", "title": "视频标题", "type": "public"}
|
|||
|
|
}
|
|||
|
|
]
|
|||
|
|
}
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
> 依赖安装:`pip install requests`(upload 子命令需要)。
|