Funcaptcha Image
ภาพรวม
FunCaptcha (หรือที่รู้จักในชื่อ Arkose Labs Captcha) เป็นประเภทแคปช่าแบบโต้ตอบที่กำหนดให้ผู้ใช้ดำเนินการต่างๆ เช่น หมุนรูปภาพ ลากและวางวัตถุเพื่อแก้ปัญหาความท้าทาย ใช้โดยเว็บไซต์หลักหลายแห่ง เช่น Roblox, Epic Games, Outlook ฯลฯ
🎮
FunCaptcha ได้รับการออกแบบมาเพื่อป้องกันบอทและสร้างประสบการณ์ที่ "สนุก" สำหรับผู้ใช้ผ่านมินิเกมแบบโต้ตอบ

1. สร้างงาน
คำขอ
POST https://api.achicaptcha.com/createTask
พารามิเตอร์
| ชื่อพารามิเตอร์ | ชนิดข้อมูล | จำเป็น? | คำอธิบาย |
|---|---|---|---|
clientKey | string | ใช่ | คีย์ API |
task.type | string | ใช่ | FuncaptchaImageTask |
task.subType | string | ใช่ | ค่าเท่ากับ 1 |
task.image | string | ใช่ | Base64 ของรูปภาพ |
task.other | string | ใช่ | คำถาม ตัวอย่าง: "Use the arrows to rotate the object to face in the direction of the hand" |
ตัวอย่างคำขอ
POST /createTask HTTP/1.1
Host: api.achicaptcha.com
Content-Type: application/json
{
"clientKey": "YOUR_API_KEY",
"task": {
"type": "FuncaptchaImageTask",
"subType": "1",
"image": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBD...",
"other": "Use the arrows to rotate the object to face in the direction of the hand"
}
}การตอบกลับ
เมื่อสำเร็จ เซิร์ฟเวอร์จะส่งคืน errorId = 0 และ taskId
{
"errorId": 0,
"taskId": "f2fc70d6-c76b-4fba-9480-205ac1fe9fb9"
}2. รับผลลัพธ์
คำขอ
POST https://api.achicaptcha.com/getTaskResult
พารามิเตอร์
| ชื่อพารามิเตอร์ | ชนิดข้อมูล | จำเป็น? | คำอธิบาย |
|---|---|---|---|
clientKey | string | ใช่ | คีย์ API |
taskId | string | ใช่ | TaskId ที่ได้รับจาก (1) |
ตัวอย่างคำขอ
POST /getTaskResult HTTP/1.1
Host: api.achicaptcha.com
Content-Type: application/json
{
"clientKey": "YOUR_API_KEY",
"taskId": "f2fc70d6-c76b-4fba-9480-205ac1fe9fb9"
}การตอบกลับ
{
"errorId": 0,
"status": "ready",
"solution": "1" // ดัชนีรูปภาพที่จะคลิก (เริ่มจาก 0)
}คำอธิบายสถานะ
errorId = 0และstatus = ready: แก้ไขสำเร็จ อ่านผลลัพธ์ในsolution.answer(อาร์เรย์ของดัชนีรูปภาพ)errorId = 0และstatus = processing: กำลังแก้แคปช่า รอ 2 วินาทีแล้วลองอีกครั้งerrorId > 0: ข้อผิดพลาดของระบบ ส่งคืนรหัสข้อผิดพลาดและคำอธิบายข้อผิดพลาด
ตัวอย่างการรวมระบบ
import requests
import time
def solve_funcaptcha_image(image_base64, question, api_key='YOUR_API_KEY'):
# Step 1: Create task
create_task_url = 'https://api.achicaptcha.com/createTask'
create_task_payload = {
'clientKey': api_key,
'task': {
'type': 'FuncaptchaImageTask',
'subType': '1',
'image': image_base64,
'other': question
}
}
response = requests.post(create_task_url, json=create_task_payload)
result = response.json()
if result['errorId'] != 0:
raise Exception(result['errorDescription'])
task_id = result['taskId']
# Step 2: Get result
get_result_url = 'https://api.achicaptcha.com/getTaskResult'
while True:
time.sleep(2) # Wait 2 seconds
get_result_payload = {
'clientKey': api_key,
'taskId': task_id
}
response = requests.post(get_result_url, json=get_result_payload)
result = response.json()
if result['errorId'] != 0:
raise Exception(result['errorDescription'])
if result['status'] == 'ready':
return result['solution']
# If status == 'processing', continue loop
# Usage
image_base64 = '/9j/4AAQSkZJRgABAQAAAQABAAD/2wBD...' # Base64 of image
question = 'Use the arrows to rotate the object to face in the direction of the hand'
solution = solve_funcaptcha_image(image_base64, question, 'YOUR_API_KEY')
print('FunCaptcha solution:', solution)รหัสข้อผิดพลาดทั่วไป
| รหัสข้อผิดพลาด | คำอธิบาย | หมายเหตุ |
|---|---|---|
| 0 | success | สำเร็จ |
| 1 | processing | กำลังประมวลผล |
| 2 | missing required fields | ขาดฟิลด์ที่จำเป็น ตรวจสอบพารามิเตอร์อีกครั้ง |
| 3 | task not supported | ไม่รองรับประเภทงาน |
| 4 | task creation failed | การสร้างงานล้มเหลว |
| 5 | client key does not exist | ไม่มีคีย์ API ตรวจสอบคีย์ API อีกครั้ง |
| 6 | insufficient account balance | ยอดเงินในบัญชีไม่เพียงพอ เติมเครดิต |
| 7 | task failed, please create a new task | งานล้มเหลว โปรดสร้างงานใหม่ |
| 8 | task ID does not exist | ไม่มี ID งาน |
แนวทางปฏิบัติที่ดีที่สุด
เพื่อให้ได้ผลลัพธ์ที่ดีที่สุดเมื่อใช้ Achicaptcha API สำหรับ FunCaptcha Image ให้ปฏิบัติตามหลักการเหล่านี้:
1. การประมวลผลรูปภาพ Base64
- รับเฉพาะรูปภาพเดียว สำหรับผู้ใช้โทรศัพท์ ให้รวมเป็นรูปภาพขนาดใหญ่หนึ่งรูปก่อนส่ง
- ตรวจสอบให้แน่ใจว่ารูปภาพได้รับการเข้ารหัสในรูปแบบ Base64 อย่างถูกต้อง
- ลบคำนำหน้า
data:image/...;base64,หากมี - ตรวจสอบว่าขนาดรูปภาพเหมาะสม (ไม่ใหญ่เกินไป)
2. คำถาม
- ระบุคำถามที่แน่นอนจากความท้าทาย FunCaptcha
- คำถามช่วยให้ระบบเข้าใจประเภทความท้าทายได้ดีขึ้น
- ตัวอย่าง: "Use the arrows to rotate the object to face in the direction of the hand"
3. ช่วงเวลาการตรวจสอบ
- รออย่างน้อย 2 วินาทีระหว่างการตรวจสอบผลลัพธ์
- อย่าสแปม API ด้วยคำขอที่ต่อเนื่องกันมากเกินไป
- ตั้งค่าการหมดเวลาเพื่อหลีกเลี่ยงลูปไม่สิ้นสุด (แนะนำ 60 วินาทีสำหรับงานรูปภาพ)
4. การประมวลผลผลลัพธ์
- ผลลัพธ์ที่ส่งคืนคือตัวเลขเดียว (ดัชนีเริ่มจาก 0)
- ใช้ผลลัพธ์นี้เพื่อส่งไปยัง FunCaptcha
5. ตรรกะการลองใหม่
- ใช้การลองใหม่สำหรับข้อผิดพลาดชั่วคราว เช่น
ERROR_NO_SLOT_AVAILABLE - ใช้ exponential backoff เมื่อลองใหม่
- จำกัดจำนวนการลองใหม่สูงสุด
6. ความปลอดภัยของคีย์ API
- อย่าฮาร์ดโค้ดคีย์ API ในโค้ด
- ใช้ตัวแปรสภาพแวดล้อม
- อย่าเปิดเผยคีย์ API ทางฝั่งไคลเอนต์
ลิงก์ที่มีประโยชน์: