गाइड
कार्य(टोकन)
Friendlycaptcha

FriendlyCaptcha: Friendly Captcha हल करना

TIP

createTask विधि से कार्य (task) बनाएँ और getTaskResult विधि से परिणाम प्राप्त करें।

हम जिस कार्य प्रकार (types) का समर्थन करते हैं:

  • FriendlyCaptchaTaskProxyless

कार्य (Task) बनाएँ

createTask विधि से एक पहचान कार्य (recognition task) बनाएँ।

कार्य वस्तु (Task Object) संरचना

विशेषताएँप्रकारआवश्यकविवरण
typeस्ट्रिंगआवश्यकFriendlyCaptchaTaskProxyless
websiteURLस्ट्रिंगआवश्यकवह पृष्ठ पता, जहाँ Friendly Captcha हल किया जाता है
websiteKeyस्ट्रिंगआवश्यकवेबसाइट कुंजी

उदाहरण अनुरोध

POST https://api.capsolver.com/createTask
Host: api.capsolver.com
Content-Type: application/json
{
  "clientKey": "YOUR_API_KEY",
  "task": {
    "type": "FriendlyCaptchaTaskProxyless",
    "websiteURL": "https://www.yourtarget.com/",
    "websiteKey": "FBTMEAFCK477GTRU"
  }
}

कार्य हमें सबमिट करने के बाद, यदि यह सफल होता है, तो आपको प्रतिक्रिया (response) में एक ‘taskId’ प्राप्त होना चाहिए। यदि आपको कार्य आईडी प्राप्त नहीं हुआ है, तो कृपया errorCode: त्रुटियों की पूरी सूची पढ़ें।

उदाहरण प्रतिक्रिया

{
    "errorId": 0,
    "errorDescription": "",
    "status": "idle",
    "taskId": "0a9b8fad-66e5-4271-96a3-bee8751cfb83"
}

परिणाम प्राप्त करना

taskId प्राप्त होने के बाद, आपको समाधान पुनः प्राप्त करने के लिए taskId सबमिट करना होगा। प्रतिक्रिया (Response) संरचना getTaskResult में समझाई गई है।

उदाहरण अनुरोध

POST https://api.capsolver.com/getTaskResult
Host: api.capsolver.com
Content-Type: application/json
 
{
    "clientKey": "YOUR_API_KEY",
    "taskId": "0a9b8fad-66e5-4271-96a3-bee8751cfb83"
}

उदाहरण प्रतिक्रिया

{
    "errorId": 0,
    "taskId": "0a9b8fad-66e5-4271-96a3-bee8751cfb83",
    "status": "ready",
    "solution": {
        "token": "72b43902cd1457f6880dd3735c50070d.Z0+9+Hcx7KGSmHd1AQwtjQ..."
    }
}

नमूना कोड

# pip install requests
import requests
import time
 
# TODO: set your config
api_key = "YOUR_API_KEY"  # your api key of capsolver
site_key = "FBTMEAFCK477GTRU"  # site key of your target site
site_url = "https://www.yourtarget.com"  # page url of your target site
 
 
def capsolver():
    payload = {
        "clientKey": api_key,
        "task": {
            "type": 'FriendlyCaptchaTaskProxyless',
            "websiteKey": site_key,
            "websiteURL": site_url
        }
    }
    res = requests.post("https://api.capsolver.com/createTask", json=payload)
    resp = res.json()
    task_id = resp.get("taskId")
    if not task_id:
        print("Failed to create task:", res.text)
        return
    print(f"Got taskId: {task_id} / Getting result...")
 
    while True:
        time.sleep(1)  # delay
        payload = {"clientKey": api_key, "taskId": task_id}
        res = requests.post("https://api.capsolver.com/getTaskResult", json=payload)
        resp = res.json()
        status = resp.get("status")
        if status == "ready":
            return resp.get("solution", {}).get('token')
        if status == "failed" or resp.get("errorId"):
            print("Solve failed! response:", res.text)
            return
 
 
token = capsolver()
print(token)