评论助推(回复)脚本配置
本页介绍用于任务创建的 boost_comment 脚本的配置参数。
我该用哪个脚本?
有两个不同的评论脚本,功能并不相同:
comment—— 在帖子上发布一条全新的顶层评论。参见评论脚本配置。boost_comment(本页)—— 点赞并/或回复某条已有评论。这就是 "REPLY COMMENT"(回复评论)/ "Boost Comments" 功能。
如果你想回复评论,那就来对地方了。
概述
boost_comment 脚本会打开一个帖子,并与其置顶评论互动 —— 可以点赞该评论、回复该评论,或两者都做。它是应用内 Boost Comments 弹窗的 API 等价功能。
与 comment 脚本不同,boost_comment 脚本会在单个任务运行中处理全部目标 URL(它内部按换行拆分 target_comment_urls,逐个处理)。每台设备(按序列号模式)或每个账号(按用户名 / 多账号模式)创建一个任务 —— 而不是每个 URL 一个任务。
脚本配置 (script_config)
参数
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
| target_comment_urls | string | 是 | "" | 要互动其置顶评论的帖子 URL。多个 URL 用换行符(\n)分隔。 |
| enable_like_comment | boolean | 是* | false | 点赞每个帖子的置顶评论。 |
| enable_reply_comment | boolean | 是* | false | 回复每个帖子的置顶评论。 |
| reply_contents | string | 当 enable_reply_comment 为 true 时必填 | "" | 回复文本。多条回复选项用换行符(\n)分隔;每个任务按 reply_order 选择其中一条。 |
| reply_order | string | 否 | "random" | 如何从 reply_contents 中选择回复:random(随机)或 sequential(顺序)。 |
| insert_emoji | boolean | 否 | false | 在回复中插入随机表情。 |
| username | string | 否 | "" | 运行前切换到该账号。省略时使用设备当前激活的账号。 |
至少需要启用一个动作
你必须至少启用一个动作:将 enable_like_comment 和/或 enable_reply_comment 设为 true。如果 enable_reply_comment 为 true,则 reply_contents 不能为空。否则 API 会返回错误 40001。
互动的是哪条评论?
脚本互动的是每个帖子的置顶(第一条)评论。在 target_comment_urls 中填写帖子 URL 即可 —— 无需指向某条单独评论的直链。
示例
回复评论(最常见的场景)
curl -X POST http://localhost:50809/api/v1/task \
-H "Content-Type: application/json" \
-d '{
"serials": ["device_serial_1"],
"script_name": "boost_comment",
"script_config": {
"target_comment_urls": "https://www.tiktok.com/@username/video/1234567890",
"enable_reply_comment": true,
"reply_contents": "Great point!\nI totally agree!\nThanks for sharing 🙌"
}
}'
回复将从 reply_contents 的三行中选择(默认随机)。
同时点赞并回复
curl -X POST http://localhost:50809/api/v1/task \
-H "Content-Type: application/json" \
-d '{
"serials": ["device_serial_1"],
"script_name": "boost_comment",
"script_config": {
"target_comment_urls": "https://www.tiktok.com/@username/video/1234567890",
"enable_like_comment": true,
"enable_reply_comment": true,
"reply_contents": "Couldn'\''t agree more!\nWell said!",
"reply_order": "sequential",
"insert_emoji": true
}
}'
在一个任务中互动多个帖子的评论
用换行符分隔多个 URL。它们都会在 同一个任务内被处理:
curl -X POST http://localhost:50809/api/v1/task \
-H "Content-Type: application/json" \
-d '{
"serials": ["device_serial_1"],
"script_name": "boost_comment",
"script_config": {
"target_comment_urls": "https://www.tiktok.com/@user1/video/111\nhttps://www.tiktok.com/@user2/video/222\nhttps://www.tiktok.com/@user3/video/333",
"enable_reply_comment": true,
"reply_contents": "Love this!\nAmazing!\nSo true!",
"reply_order": "random"
}
}'
仅点赞(不回复)
curl -X POST http://localhost:50809/api/v1/task \
-H "Content-Type: application/json" \
-d '{
"serials": ["device_serial_1"],
"script_name": "boost_comment",
"script_config": {
"target_comment_urls": "https://www.tiktok.com/@username/video/1234567890",
"enable_like_comment": true
}
}'