转发脚本配置
本页面介绍创建任务时 repost 脚本的配置参数。
概述
repost 脚本用于自动转发 TikTok 视频。通过 API 提供多个目标帖子 URL 时,系统会为每个 URL 创建一个任务。使用 start_time 参数来控制任务的执行时间。
仅支持 TikTok
repost 脚本仅支持 TikTok。Instagram 没有原生转发功能。
脚本配置 (script_config)
script_config 对象包含转发脚本的参数。以下是可用参数:
参数
| 参数 | 类型 | 必需 | 默认值 | 描述 |
|---|---|---|---|---|
| target_post_urls | string[] | Yes* | [] | 要转发的目标帖子 URL 数组(每个 URL 一个任务) |
| target_post_url | string | Yes* | "" | 单个目标帖子 URL,或多个 URL 以换行/逗号分隔 |
备注
必须提供 target_post_urls 数组或 target_post_url 字符串。如果两者都提供,target_post_urls 优先。
任务创建
当提供多个目标帖子 URL 时,API 会为每个 URL 创建一个任务。例如,3 个 URL + 2 个设备 = 6 个任务。使用 start_time 参数控制任务的执行时间。
示例
转发单个帖子
curl -X POST http://localhost:50809/api/v1/task \
-H "Content-Type: application/json" \
-d '{
"serials": ["device_serial_1"],
"script_name": "repost",
"script_config": {
"target_post_url": "https://www.tiktok.com/@username/video/1234567890"
}
}'
转发多个帖子
转发多个帖子时,每个帖子创建一个任务:
curl -X POST http://localhost:50809/api/v1/task \
-H "Content-Type: application/json" \
-d '{
"serials": ["device_serial_1"],
"script_name": "repost",
"script_config": {
"target_post_urls": [
"https://www.tiktok.com/@user1/video/111",
"https://www.tiktok.com/@user2/video/222",
"https://www.tiktok.com/@user3/video/333"
]
}
}'
这将创建 3 个独立的任务,立即执行。
使用开始时间调度转发
使用 start_time 来调度任务的开始时间:
curl -X POST http://localhost:50809/api/v1/task \
-H "Content-Type: application/json" \
-d '{
"serials": ["device_serial_1"],
"script_name": "repost",
"script_config": {
"target_post_url": "https://www.tiktok.com/@username/video/1234567890"
},
"start_time": "14:30"
}'
通过用户名列表转发
直接为特定账号创建转发任务:
curl -X POST http://localhost:50809/api/v1/task \
-H "Content-Type: application/json" \
-d '{
"usernames": ["@my_account1", "@my_account2"],
"script_name": "repost",
"script_config": {
"target_post_url": "https://www.tiktok.com/@target/video/123"
}
}'
多设备批量转发
curl -X POST http://localhost:50809/api/v1/task \
-H "Content-Type: application/json" \
-d '{
"serials": ["device_1", "device_2", "device_3"],
"script_name": "repost",
"script_config": {
"target_post_url": "https://www.tiktok.com/@viral/video/999"
},
"enable_multi_account": true
}'
响应
{
"code": 0,
"message": "success",
"data": {
"task_ids": [401, 402, 403],
"created_count": 3
}
}
帖子 URL 格式
TikTok
https://www.tiktok.com/@username/video/1234567890123456
https://vm.tiktok.com/ABCDEFG/
转发工作原理
- 脚本打开目标帖子 URL。
- 检查帖子是否已转发——如果是,则跳过以避免重复转发。
- 点击分享按钮,然后从分享菜单中选择转发。
- 确认转发操作。
最佳实践
-
调度任务:使用
start_time参数将转发分散在一段时间内,减少触发频率限制的可能性。 -
合理批量:不要一次创建太多转发任务,平台可能对转发有频率限制。
-
使用多账号模式:启用
enable_multi_account以在同一设备上使用多个账号转发视频。
错误代码
| Code | Description |
|---|---|
| 40001 | 目标帖子 URL 缺失 |
| 40003 | API 不支持该脚本 |
| 40301 | API 访问需要 Pro+ 套餐 |