การตั้งค่าสคริปต์ Comment
หน้านี้อธิบายพารามิเตอร์การตั้งค่าสำหรับสคริปต์ comment ที่ใช้ตอนสร้างงาน
ภาพ รวม
สคริปต์ comment ใช้สำหรับคอมเมนต์โพสต์บน TikTok หรือ Instagram อัตโนมัติ เมื่อคุณส่ง URL โพสต์เป้าหมายหลายรายการผ่าน API ระบบจะ สร้าง 1 งานต่อ URL เป้าหมาย 1 รายการ คุณสามารถใช้ start_time เพื่อกำหนดเวลาเริ่มของแต่ละงานได้
การตั้งค่าสคริปต์ (script_config)
อ็อบเจ็กต์ script_config เก็บพารามิเตอร์ของสคริปต์ comment ดังนี้
พารามิเตอร์
| พารามิเตอร์ | ชนิด | จำเป็น | ค่าเริ่มต้น | คำอธิบาย |
|---|---|---|---|---|
| target_post_urls | string[] | ใช่* | [] | รายการ URL โพสต์เป้าหมายที่จะคอมเมนต์ (1 URL = 1 งาน) |
| 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 ก่อน
พารามิเตอร์ comment_image_path ช่วยให้คุณแนบรูปไปกับคอมเมนต์ได้ ฟีเจอร์นี้ รองรับเฉพาะ TikTok - Instagram ไม่รองรับการแนบรูปในคอมเมนต์ รูปจะถูกส่งเข้าอุปกรณ์และเลือกเป็นรูปแรกในแกลเลอรี
เมื่อมี URL โพสต์เป้าหมายหลายรายการ API จะ สร้าง 1 งานต่อ URL โพสต์เป้าหมาย เช่น หากกำหนด URL 3 รายการและอุปกรณ์ 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"
}'
คอมเมนต์พร้อมแทรกอีโมจิ
เปิดการแทรกอีโมจิอัตโนมัติ เพื่อให้คอมเมนต์ดูเป็นธรรมชาติมากขึ้น:
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": "สุดยอดมาก",
"insert_emoji": true
}
}'
คอมเมนต์ด้วยโหมดรายการ username
สร้างงานคอมเมนต์ให้บัญชีที่ระบุโดยตรง:
curl -X POST http://localhost:50809/api/v1/task \
-H "Content-Type: application/json" \
-d '{
"usernames": ["@my_account1", "@my_account2"],
"script_name": "comment",
"script_config": {
"target_post_url": "https://www.tiktok.com/@target/video/123",
"comment_content": "วิดีโอนี้ดีมาก!"
}
}'