«2Captcha»标志返回主页
Captcha 绕过教程

这篇文章有帮助吗?

How to bypass reCAPTCHA v2 on Zlookup

Gregory Fisher
Gregory Fisher

Technical engineer

The Zlookup website (zlookup.com) uses reCAPTCHA v2 protection to secure its email verification forms from automated requests. The key feature of bypassing this captcha is not just obtaining the token, but injecting it correctly.

Modern reCAPTCHA v2 implementations often do not read tokens directly from hidden form fields. Instead, the site expects a special JavaScript callback function to be triggered with the received token. In this guide, we will break down how to extract the parameters, solve the captcha via API v2, and correctly pass the token through the callback.

Task Parameters

To send a task via the modern API v2, the createTask endpoint is used. The task object must contain the following parameters:

Parameter Type Required Description
type String Yes Task type: RecaptchaV2TaskProxyless or RecaptchaV2Task
websiteURL String Yes Full URL of the page where the captcha is located
websiteKey String Yes Public reCAPTCHA site key (starts with 6L...)
isInvisible Boolean No Set to true if the site uses the invisible version of reCAPTCHA (Invisible)

How to find parameters

Parameters for reCAPTCHA v2 are static and can be easily extracted from the page source code or network requests.

Method 1: Via page source code (Elements tab)

  1. Open the website https://www.zlookup.com/ in your browser.
  2. Press F12 to open Developer Tools (DevTools) and go to the Elements tab.
  3. Press Ctrl+F (or Cmd+F) and search for g-recaptcha or data-sitekey.
  4. You will find a div element similar to this:
  5. The value of the data-sitekey attribute is your websiteKey.
  6. Copy the full URL from the browser's address bar. This will be your websiteURL.

Method 2: Via network requests (Network tab)
If you cannot find the key in the source code (for example, it is loaded dynamically), you can intercept it from network traffic:

  1. Open Developer Tools (F12) and go to the Network tab.
  2. Enable Preserve log and reload the page or perform the action that triggers the captcha.
  3. In the filter, type recaptcha or api.js.
  4. Find requests to Google servers, such as /recaptcha/api2/anchor or /recaptcha/api2/reload.
  5. Click on the request and go to the Payload or Params tab.
  6. In the URL parameters (Query String Parameters), find the k field. Its value (e.g., 6LcXOgkUAAAAAHDrb05dOxG4yI5_Na4FmjFBUhPr) is your websiteKey.

Code Examples

Python + requests (API v2)

Example of sending a task and polling for the result using the requests library via API v2 endpoints.

python Copy
import requests
import time

API_KEY = 'YOUR_API_KEY'
WEBSITE_URL = 'https://www.zlookup.com/'
WEBSITE_KEY = '6LcXOgkUAAAAAHDrb05dOxG4yI5_Na4FmjFBUhPr'

# 1. Create task via API v2
url = 'https://api.2captcha.com/createTask'
headers = {
    'Content-Type': 'application/json'
}
payload = {
    "clientKey": API_KEY,
    "task": {
        "type": "RecaptchaV2TaskProxyless",
        "websiteURL": WEBSITE_URL,
        "websiteKey": WEBSITE_KEY
    }
}

response = requests.post(url, headers=headers, json=payload)
result = response.json()

if result.get('errorId') == 0:
    task_id = result.get('taskId')
    print(f"Task created, ID: {task_id}")
    
    # 2. Get result via API v2
    res_url = 'https://api.2captcha.com/getTaskResult'
    while True:
        time.sleep(5) # Pause between requests
        
        res_payload = {
            "clientKey": API_KEY,
            "taskId": task_id
        }
        
        res_response = requests.post(res_url, headers=headers, json=res_payload).json()
        
        if res_response.get('errorId') == 0 and res_response.get('status') == 'ready':
            print("Captcha solved successfully!")
            token = res_response['solution']['gRecaptchaResponse']
            print(f"Token: {token}")
            break
        elif res_response.get('errorId') != 0:
            print(f"Error: {res_response.get('errorDescription')}")
            break
        else:
            # Status processing - task is not ready yet
            continue
else:
    print(f"Task creation error: {result.get('errorDescription')}")

Python + Playwright

Example of automation that dynamically extracts the sitekey, sends the task via API v2, and injects the token via callback.

python Copy
from playwright.sync_api import sync_playwright
import requests
import time

API_KEY = 'YOUR_API_KEY'
TARGET_URL = 'https://www.zlookup.com/'

def solve_zlookup_recaptcha_v2():
    with sync_playwright() as p:
        browser = p.chromium.launch(headless=False)
        page = browser.new_page()
        
        try:
            page.goto(TARGET_URL)
            
            # Wait for the reCAPTCHA widget to appear
            page.wait_for_selector('.g-recaptcha', timeout=10000)
            
            # Extract sitekey from the data-sitekey attribute
            site_key = page.evaluate("""
                () => {
                    const captchaDiv = document.querySelector('.g-recaptcha');
                    return captchaDiv ? captchaDiv.getAttribute('data-sitekey') : null;
                }
            """)
            
            if not site_key:
                raise Exception("Failed to find reCAPTCHA sitekey on the page.")
            
            print(f"Found sitekey: {site_key}")
            
            # Send to API v2
            api_url = 'https://api.2captcha.com/createTask'
            headers = {'Content-Type': 'application/json'}
            payload = {
                "clientKey": API_KEY,
                "task": {
                    "type": "RecaptchaV2TaskProxyless",
                    "websiteURL": page.url,
                    "websiteKey": site_key
                }
            }
            
            task_response = requests.post(api_url, headers=headers, json=payload).json()
            if task_response.get('errorId') != 0:
                raise Exception(f"Task creation error: {task_response.get('errorDescription')}")
                
            task_id = task_response.get('taskId')
            
            # Waiting for the solution via getTaskResult
            res_url = 'https://api.2captcha.com/getTaskResult'
            token = None
            for _ in range(20):
                time.sleep(5)
                res = requests.post(res_url, headers=headers, json={"clientKey": API_KEY, "taskId": task_id}).json()
                if res.get('status') == 'ready':
                    token = res['solution']['gRecaptchaResponse']
                    break
                if res.get('errorId') != 0:
                    print(f"API error: {res.get('errorDescription')}")
                    break
                    
            if token:
                print(f"Token received: {token}")
                
                # Injecting the token via callback
                # Detailed instructions on finding the exact callback name: 
                # https://2captcha.com/h/recaptcha-v2-callback
                page.evaluate(f"""
                    // 1. Attempt to find and call the named callback (replace 'yourCallbackName' with the real one if it exists in data-callback)
                    if (typeof yourCallbackName === 'function') {{
                        yourCallbackName("{token}");
                    }}
                    
                    // 2. Alternative universal injection method via internal grecaptcha structure
                    const textarea = document.querySelector('textarea[name="g-recaptcha-response"]');
                    if (textarea) {{
                        textarea.value = "{token}";
                        textarea.dispatchEvent(new Event('change', {{ bubbles: true }}));
                    }}
                    
                    console.log("Token injection attempted");
                """)
                print("Token passed via callback/DOM.")
            else:
                print("Failed to get token.")
                
        except Exception as e:
            print(f"Error: {e}")
        finally:
            # browser.close()

if __name__ == '__main__':
    solve_zlookup_recaptcha_v2()

How to use the received token (Passing via callback)

The Zlookup website, like many other modern sites with reCAPTCHA v2, may ignore the token if it is simply placed in a hidden field. The site expects the widget to report successful validation by triggering a callback function.

To implement this correctly:

  1. Examine the page source code (Elements tab). Find the div with the class g-recaptcha.
  2. Check if it has a data-callback="function_name" attribute. If it does, simply call this function via page.evaluate, passing it the token: function_name("YOUR_TOKEN").
  3. If there is no data-callback attribute, use the universal injection method via the internal ___grecaptcha_cfg structure, which is described in detail in our specialized article: How to pass reCAPTCHA v2 token via callback (https://2captcha.com/h/recaptcha-v2-callback).

Common Errors and Solutions

Error / Problem Cause Solution
ERROR_WRONG_USER_KEY Invalid or empty API key. Check that the key is copied correctly from the dashboard.
ERROR_INVALID_GOOGLE_KEY Invalid websiteKey or domain mismatch. Ensure the key starts with 6L and is copied without extra spaces. websiteURL must exactly match the key's domain.
Token not accepted by the form Incorrect token injection method (site expects callback). Do not rely solely on hidden fields. Find the callback function in the source code or use the method from the callback article.
ERROR_CAPTCHA_UNSOLVABLE The captcha cannot be solved (expired). Ensure you are not waiting too long before sending the task, and that the websiteURL is current.