Skip to content
API
ReCAPTCHA
图片

ReCAPTCHA 图像识别(手机端)

概述

超快速解决 Recaptcha,市场准确率第一。我们提供服务来解决手机上的所有类型的 ReCaptcha 图像。

📱

此服务允许您发送验证码图像并接收要点击的单元格索引以解决验证码。

ReCAPTCHA Mobile

1. 创建任务

请求

POST https://api.achicaptcha.com/createTask

参数

参数名称数据类型是否必需描述
clientKeystringApi 密钥
task.typestringReCaptchaPhoneTask
task.subTypestring值等于 0
task.imagestringBase64 格式的验证码图像,捕获验证码图像显示区域(无边框,仅小方格单元格)
task.otherstring问题|网格数
• 问题:"Select all images with a bus"(captcha 提示中显示的完整问题文本)
• 网格数:3(或 4、5)
→ other:"Select all images with a bus|4"

请求示例

POST /createTask HTTP/1.1
Host: api.achicaptcha.com
Content-Type: application/json
 
{
  "clientKey": "YOUR_API_KEY",
  "task": {
    "type": "ReCaptchaPhoneTask",
    "subType": "0",
    "image": "iVBORw0KGgoAAAANSUhEUgAA...(base64 encoded image)",
    "other": "Select all images with a bus|4"
  }
}

响应

成功时,服务器返回 errorId = 0taskId

{
  "errorId": 0,
  "taskId": "f2fc70d6-c76b-4fba-9480-205ac1fe9fb9"
}

2. 获取结果

请求

POST https://api.achicaptcha.com/getTaskResult

参数

参数名称数据类型是否必需描述
clientKeystringApi 密钥
taskIdstring从 (1) 获得的 TaskId

请求示例

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": "0,5,9"
}

注意: 对于 "grid" 类型,solution 是要点击的图像索引列表,从 0 开始

状态说明

  • errorId = 0:成功解决,从 solution 中读取结果
  • errorId = 1:正在解决验证码,等待 2-3 秒后重试
  • errorId > 1:系统错误,返回错误代码和描述

集成示例

import requests
import time
 
def solve_recaptcha_phone(image_base64, question, grid_count, api_key='YOUR_API_KEY'):
    # 步骤 1:创建任务
    create_task_url = 'https://api.achicaptcha.com/createTask'
    create_task_payload = {
        'clientKey': api_key,
        'task': {
            'type': 'ReCaptchaPhoneTask',
            'subType': '0',
            'image': image_base64,
            'other': f'{question}|{grid_count}'
        }
    }
    
    response = requests.post(create_task_url, json=create_task_payload)
    result = response.json()
    
    if result['errorId'] > 1:
        raise Exception(result['errorDescription'])
    
    task_id = result['taskId']
    
    # 步骤 2:获取结果
    get_result_url = 'https://api.achicaptcha.com/getTaskResult'
    
    while True:
        time.sleep(2)  # 等待 2-3 秒
        
        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'] > 1:
            raise Exception(result['errorDescription'])
        
        if result['status'] == 'ready':
            return result['solution']  # 返回 "0,5,9" - 要点击的索引
        
        # 如果 status == 'processing',继续循环
 
# 使用方法
image_base64 = 'iVBORw0KGgoAAAANSUhEUgAA...'  # Base64 编码的验证码图像
question = 'Select all images with a bus'  # Full question text from the captcha prompt
grid_count = 4  # 网格数(3、4 或 5)
solution = solve_recaptcha_phone(image_base64, question, grid_count, 'YOUR_API_KEY')
print('要点击的网格索引:', solution)  # 示例:"0,5,9"
 
# 使用 solution 点击相应的单元格
indices = [int(i) for i in solution.split(',')]
for index in indices:
    # 点击相应索引的单元格
    print(f'点击单元格索引: {index}')

常见错误码

错误码描述备注
0成功成功
1处理中处理中
2缺少必填字段缺少必填字段,请再次检查参数
3不支持的任务不支持的任务类型
4任务创建失败任务创建失败
5客户端密钥不存在API 密钥不存在,请再次检查 API 密钥
6账户余额不足账户余额不足,请添加更多积分
7任务失败,请创建新任务任务失败,请创建新任务
8任务 ID 不存在任务 ID 不存在

最佳实践

为了在使用 Achicaptcha API 时获得最佳结果,请遵循以下原则:

1. 准备验证码图像

  • 清晰地捕获验证码图像显示区域,不包含边框或其他 UI 元素
  • 仅包含验证码的小方格单元格(网格)
  • 图像采用 base64 格式
  • 确保图像具有足够的分辨率以供识别

2. 确定准确信息

  • 从验证码的粗体文本部分获取问题(示例:"Select all images with a bus"、"Select all squares with traffic lights")
  • 确定正确的网格数(3x3、4x4 或 5x5)
  • 正确格式化 other:"问题|网格数"(示例:"Select all images with a bus|4")

3. 轮询间隔

  • 在结果检查之间至少等待 2-3 秒
  • 不要用太多连续请求向 API 发送垃圾信息
  • 设置超时以避免无限循环(建议 120 秒)

4. 处理结果

  • 返回的解决方案是要点击的索引字符串,用逗号分隔(示例:"0,5,9")
  • 索引从 0 开始,从左到右、从上到下计数
  • 解析字符串并点击相应的单元格

5. 重试逻辑

  • 对临时错误(如 ERROR_NO_SLOT_AVAILABLE)实施重试
  • 重试时使用指数退避
  • 限制最大重试次数

6. API 密钥安全

  • 不要在代码中硬编码 API 密钥
  • 使用环境变量
  • 不要在客户端暴露 API 密钥

有用链接: