评论脚本配置
本页介绍用于任务创建的 comment 脚本的配置参数。
概述
comment 脚本用于自动在 TikTok 或 Instagram 帖子上发布评论。当您通过 API 提供多个目标帖子 URL 时,每个目标帖子 URL 创建一个任务。您可以使用 start_time 参数控制每个任务的执行时间。
脚本配置 (script_config)
script_config 对象包含评论脚本的参数。以下是可用的参数:
参数
| 参数 | 类型 | 必填 | 默认值 | 描述 |
|---|---|---|---|---|
| target_post_urls | string[] | 是* | [] | 要评论的目标帖子 URL 数组(每个 URL 一个任务) |
| target_post_url | string | 是* | "" | 单个目标帖子 URL 或用换行符/逗号分隔的多个 URL |
| comment_content | string | 是 | "" | 评论文本内容。可以包含用换 行符分隔的多条评论 |
| comment_order | string | 否 | "random" | 如何选择评论:random(随机)或 sequential(顺序) |
| insert_emoji | boolean | 否 | false | 是否在评论中插入随机表情符号 |
| comment_image_path | string | 否 | "" | 图片评论的图片文件路径(仅限 TikTok)。支持绝对路径或相对于 work_dir/upload/ 的相对路径 |
备注
必须提供 target_post_urls 数组或 target_post_url 字符串。如果两者都提供,target_post_urls 优先。
图片评论(仅限 TikTok)
comment_image_path 参数允许您在评论中附加图片。此功能仅在 TikTok 上支持 - Instagram 评论不支持图片附件。图片将被推送到设备并作为图库中的第一张图片被选择。
任务创建
当提供多个目标帖子 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": "comment",
"script_config": {
"target_post_url": "https://www.tiktok.com/@username/video/1234567890",
"comment_content": "精彩内容!🔥"
}
}'
使用多个评论选项
提供用换行符分隔的多条评论。系统将根据 comment_order 选择其中一条:
curl -X POST http://localhost:50809/api/v1/task \
-H "Content-Type: application/json" \
-d '{
"serials": ["device_serial_1"],
"script_name": "comment",
"script_config": {
"target_post_url": "https://www.tiktok.com/@username/video/1234567890",
"comment_content": "视频太棒了!\n喜欢这个内容!\n继续加油!👏\n真的很不错!",
"comment_order": "random"
}
}'
评论多个帖子
当评论多个帖子时,每个帖子创建一个任务:
curl -X POST http://localhost:50809/api/v1/task \
-H "Content-Type: application/json" \
-d '{
"serials": ["device_serial_1"],
"script_name": "comment",
"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"
],
"comment_content": "好视频!\n太棒了!\n喜欢!",
"comment_order": "sequential"
}
}'
这将创建 3 个立即执行的独立任务。
定时评论
使用 start_time 安排任务开始执行的时间:
curl -X POST http://localhost:50809/api/v1/task \
-H "Content-Type: application/json" \
-d '{
"serials": ["device_serial_1"],
"script_name": "comment",
"script_config": {
"target_post_url": "https://www.tiktok.com/@username/video/1234567890",
"comment_content": "定时评论!"
},
"start_time": "14:30"
}'