UNLOCK API
Click coordinates

Click coordinates

Paano magpadala ng Click coordinates task sa UNLOCK API gamit ang createTask o in.php: mga pangalan ng task type, bawat parameter, ang solution object, mga proxy field at code sample sa 7 wika.
Presyo
$0.60 $0.0006 bawat task
Ipapadala mo
Ang image bilang base64 at kung ano ang iki-click
Matatanggap mo
Ang mga x at y na point na iki-click

Overview at presyo

Mga pangalan ng task type

Isa lang ang pangalan ng type na ito.
CoordinatesTask

Tinatanggap din: ImageToCoordinatesTask

Task object

type
StringRequired
Pangalan ng task type. Tumutugma kahit anong letter case. CoordinatesTask
body
StringRequired
Ang image bilang base64 (JPG, PNG o GIF), hanggang mga 100 KB. Puwede ang data: prefix.
comment
StringOptional
Instruction para sa solver, halimbawa ang tanong na nasa itaas ng image.
minClicks
IntegerOptional
Pinakakaunting point na iki-click.
maxClicks
IntegerOptional
Pinakamaraming point na iki-click.

Ang mga field na wala sa listahang ito ay ipinapasa sa solver kung paano ipinadala.

Request

POST /createTask
{
  "clientKey": "YOUR_API_KEY",
  "task": {
    "type": "CoordinatesTask",
    "body": "/9j/4AAQSkZJRgABAQ...",
    "comment": "Click the cat"
  }
}

Solution object

Ibinabalik sa solution kapag ready ang status.
coordinates
Array
Mga point na iki-click, sa pixel mula sa kaliwang itaas na sulok ng image.
POST /getTaskResult
{
  "errorId": 0,
  "taskId": 1001,
  "status": "ready",
  "solution": {
    "coordinates": [
      {
        "x": 114,
        "y": 73
      },
      {
        "x": 201,
        "y": 112
      }
    ]
  },
  "cost": "0.0006",
  "createTime": 1791640000,
  "endTime": 1791640014,
  "solveCount": 1
}

Mga code sample

import time, requests

API = "https://unlock-api.com"
KEY = "YOUR_API_KEY"

task = requests.post(f"{API}/createTask", json={
    "clientKey": KEY,
    "task": {
      "type": "CoordinatesTask",
      "body": "/9j/4AAQSkZJRgABAQ...",
      "comment": "Click the cat"
    }
}).json()
if task["errorId"]:
    raise SystemExit(task["errorCode"])

for _ in range(60):   # 60 x 5 s = the 5 minute task limit
    time.sleep(5)
    r = requests.post(f"{API}/getTaskResult", json={"clientKey": KEY, "taskId": task["taskId"]}).json()
    if r["errorId"]:
        raise SystemExit(f"{r['errorCode']}: {r.get('errorDescription', '')}")   # failed tasks are refunded
    if r["status"] == "ready":
        print(r["solution"])
        break
else:
    raise SystemExit("timed out")

in.php form method

Parehong task gamit ang classic na form request. Ibinabalik ng res.php ang sagot bilang text.
in.php, res.php
curl -s "https://unlock-api.com/in.php" -d "key=YOUR_API_KEY&method=base64&coordinatescaptcha=1&textinstructions=Click+the+cat&body=BASE64_IMAGE&json=1"
# {"status":1,"request":"1001"}

curl -s "https://unlock-api.com/res.php?key=YOUR_API_KEY&action=get&id=1001&json=1"
# {"status":0,"request":"CAPCHA_NOT_READY"}  then  {"status":1,"request":"ANSWER"}

Form API: in.php at res.php