Integrations

Bright Data + CaptchaAI: Hướng dẫn tích hợp proxy hoàn chỉnh

Bright Data (trước đây là Luminati) cung cấp mạng proxy lớn nhất - hơn 72 triệu IP dân cư trên 195 quốc gia. Kết hợp với CaptchaAI, bạn sẽ có được IP sạch để duyệt cùng với khả năng giải CAPTCHA tự động khi có thử thách xuất hiện.


Kiến trúc

Your Script ──▶ Bright Data Proxy ──▶ Target Site
                                          │
                                    CAPTCHA appears
                                          │
                                    CaptchaAI API ──▶ Solved token
                                          │
                            Inject token ◀─┘

CaptchaAI không định tuyến qua proxy của bạn — nó giải quyết phía máy chủ bằng cơ sở hạ tầng của chính nó. Proxy của bạn xử lý việc duyệt; CaptchaAI xử lý CAPTCHA.


Các loại proxy dữ liệu sáng

loại IP Tốc độ Chi phí Tỷ lệ CAPTCHA
Trung tâm dữ liệu 770K+ Nhanh Thấp Cao hơn
Khu dân cư 72 triệu+ Trung bình Trung bình Hạ xuống
ISP 700K+ Nhanh Cao Thấp nhất
Di động 7 triệu+ Chậm Cao Rất thấp

Tích hợp Python

Yêu cầu + Dữ liệu sáng + CaptchaAI

import requests
import time

CAPTCHAAI_KEY = "YOUR_API_KEY"
CAPTCHAAI_URL = "https://ocr.captchaai.com"

# Bright Data proxy credentials
BRIGHT_DATA_PROXY = {
    "http": "http://brd-customer-CUSTOMER_ID-zone-ZONE:PASSWORD@brd.superproxy.io:22225",
    "https": "http://brd-customer-CUSTOMER_ID-zone-ZONE:PASSWORD@brd.superproxy.io:22225",
}

def fetch_with_proxy(url):
    """Fetch a page through Bright Data proxy."""
    resp = requests.get(
        url,
        proxies=BRIGHT_DATA_PROXY,
        headers={
            "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
            "AppleWebKit/537.36 (KHTML, like Gecko) "
            "Chrome/126.0.0.0 Safari/537.36"
        },
        timeout=30,
    )
    return resp

def solve_recaptcha(site_url, sitekey):
    """Solve reCAPTCHA v2 via CaptchaAI."""
    resp = requests.post(f"{CAPTCHAAI_URL}/in.php", data={
        "key": CAPTCHAAI_KEY,
        "method": "userrecaptcha",
        "googlekey": sitekey,
        "pageurl": site_url,
        "json": 1,
    })
    data = resp.json()
    if data["status"] != 1:
        raise Exception(f"Submit: {data['request']}")

    task_id = data["request"]

    for _ in range(60):
        time.sleep(5)
        resp = requests.get(f"{CAPTCHAAI_URL}/res.php", params={
            "key": CAPTCHAAI_KEY,
            "action": "get",
            "id": task_id,
            "json": 1,
        })
        data = resp.json()
        if data["request"] == "CAPCHA_NOT_READY":
            continue
        if data["status"] == 1:
            return data["request"]
        raise Exception(f"Solve: {data['request']}")

    raise TimeoutError("Solve timeout")

def solve_turnstile(site_url, sitekey):
    """Solve Cloudflare Turnstile via CaptchaAI."""
    resp = requests.post(f"{CAPTCHAAI_URL}/in.php", data={
        "key": CAPTCHAAI_KEY,
        "method": "turnstile",
        "sitekey": sitekey,
        "pageurl": site_url,
        "json": 1,
    })
    data = resp.json()
    task_id = data["request"]

    for _ in range(60):
        time.sleep(5)
        resp = requests.get(f"{CAPTCHAAI_URL}/res.php", params={
            "key": CAPTCHAAI_KEY,
            "action": "get",
            "id": task_id,
            "json": 1,
        })
        data = resp.json()
        if data["request"] != "CAPCHA_NOT_READY":
            return data["request"]

    raise TimeoutError("Solve timeout")

Selenium + Dữ liệu sáng + CaptchaAI

from selenium import webdriver
from selenium.webdriver.common.by import By
import time

BRIGHT_DATA_HOST = "brd.superproxy.io"
BRIGHT_DATA_PORT = 22225
BRIGHT_DATA_USER = "brd-customer-CUSTOMER_ID-zone-residential"
BRIGHT_DATA_PASS = "PASSWORD"

def create_driver_with_proxy():
    options = webdriver.ChromeOptions()
    options.add_argument(
        f"--proxy-server=http://{BRIGHT_DATA_HOST}:{BRIGHT_DATA_PORT}"
    )
    options.add_argument("")
    options.add_argument("--window-size=1920,1080")

    driver = webdriver.Chrome(options=options)
    return driver

def scrape_with_captcha_solving(url, sitekey=None):
    driver = create_driver_with_proxy()

    try:
        driver.get(url)
        time.sleep(3)

        # Auto-detect sitekey if not provided
        if not sitekey:
            sitekey = driver.execute_script(
                "return document.querySelector('[data-sitekey]')"
                "?.getAttribute('data-sitekey')"
            )

        if sitekey:
            token = solve_recaptcha(url, sitekey)

            driver.execute_script(f"""
                document.querySelector('#g-recaptcha-response').value = '{token}';
                document.querySelectorAll('[name="g-recaptcha-response"]')
                    .forEach(el => {{ el.value = '{token}'; }});
            """)

            # Trigger callback
            driver.execute_script("""
                if (typeof ___grecaptcha_cfg !== 'undefined') {
                    const clients = ___grecaptcha_cfg.clients;
                    for (const key in clients) {
                        for (const prop in clients[key]) {
                            const val = clients[key][prop];
                            if (val && typeof val === 'object') {
                                for (const p in val) {
                                    if (typeof val[p]?.callback === 'function') {
                                        val[p].callback(arguments[0]);
                                    }
                                }
                            }
                        }
                    }
                }
            """)

        return driver.page_source

    finally:
        driver.quit()

Nhắm mục tiêu theo quốc gia cụ thể

Bright Data hỗ trợ nhắm mục tiêu theo quốc gia, tiểu bang và thành phố:

# Country targeting
proxy_us = "http://brd-customer-ID-zone-residential-country-us:PASS@brd.superproxy.io:22225"
proxy_uk = "http://brd-customer-ID-zone-residential-country-gb:PASS@brd.superproxy.io:22225"
proxy_de = "http://brd-customer-ID-zone-residential-country-de:PASS@brd.superproxy.io:22225"

# City targeting
proxy_nyc = "http://brd-customer-ID-zone-residential-country-us-city-newyork:PASS@brd.superproxy.io:22225"

# Use the geo-matched proxy for lower CAPTCHA rates
def scrape_localized(url, country="us"):
    proxy = f"http://brd-customer-ID-zone-residential-country-{country}:PASS@brd.superproxy.io:22225"
    resp = requests.get(url, proxies={"http": proxy, "https": proxy}, timeout=30)
    return resp

Quản lý phiên

# Sticky session (same IP for entire session)
proxy_sticky = (
    "http://brd-customer-ID-zone-residential"
    "-session-abc123:PASS@brd.superproxy.io:22225"
)

# Rotating (new IP each request)
proxy_rotating = (
    "http://brd-customer-ID-zone-residential:PASS@brd.superproxy.io:22225"
)

Đối với quy trình làm việc của CAPTCHA: Sử dụng phiên cố định. Mã thông báo CAPTCHA được liên kết với IP đã tải trang — sử dụng IP khác để gửi sẽ không thành công.


Tích hợp Node.js

const axios = require("axios");
const https = require("https");

const CAPTCHAAI_KEY = "YOUR_API_KEY";
const CAPTCHAAI_URL = "https://ocr.captchaai.com";

const proxyAgent = new (require("https-proxy-agent"))(
  "http://brd-customer-ID-zone-residential:PASS@brd.superproxy.io:22225"
);

async function fetchWithProxy(url) {
  return axios.get(url, {
    httpsAgent: proxyAgent,
    headers: {
      "User-Agent":
        "Mozilla/5.0 (Windows NT 10.0; Win64; x64) Chrome/126.0.0.0",
    },
  });
}

async function solveCaptcha(siteUrl, sitekey) {
  const submit = await axios.post(`${CAPTCHAAI_URL}/in.php`, null, {
    params: {
      key: CAPTCHAAI_KEY,
      method: "userrecaptcha",
      googlekey: sitekey,
      pageurl: siteUrl,
      json: 1,
    },
  });

  const taskId = submit.data.request;

  for (let i = 0; i < 60; i++) {
    await new Promise((r) => setTimeout(r, 5000));

    const result = await axios.get(`${CAPTCHAAI_URL}/res.php`, {
      params: {
        key: CAPTCHAAI_KEY,
        action: "get",
        id: taskId,
        json: 1,
      },
    });

    if (result.data.request === "CAPCHA_NOT_READY") continue;
    if (result.data.status === 1) return result.data.request;
  }

  throw new Error("Timeout");
}

Cấu hình vùng dữ liệu sáng

Cài đặt vùng Được đề xuất cho CAPTCHA tại sao
Loại proxy Khu dân cư Tỷ lệ kích hoạt CAPTCHA thấp nhất
Nhắm mục tiêu theo quốc gia Phù hợp với vị trí trang web mục tiêu Tính nhất quán của nội dung IP
Loại phiên dính Mã thông báo phải khớp với IP gốc
Bộ lọc chất lượng IP chất lượng cao Tránh IP bị gắn cờ
Đồng thời tối đa 100+ Quy trình làm việc CAPTCHA song song

Khắc phục sự cố

Vấn đề Nguyên nhân Cách xử lý
407 từ proxy Thông tin xác thực sai Xác minh ID khách hàng, vùng và mật khẩu
CAPTCHA xuất hiện mọi yêu cầu Đã phát hiện proxy trung tâm dữ liệu Chuyển sang khu dân cư
Mã thông báo bị từ chối IP đã thay đổi giữa giải quyết và gửi Sử dụng phiên cố định
Phản hồi chậm Nút thoát bị tắc nghẽn Nhắm mục tiêu quốc gia ít phổ biến/city
Kết nối bị từ chối Đã đạt đến giới hạn băng thông Kiểm tra bảng điều khiển Bright Data

Câu hỏi thường gặp

CaptchaAI có sử dụng proxy Dữ liệu sáng của tôi không?

Không. CaptchaAI giải CAPTCHA bằng cơ sở hạ tầng của chính nó. Proxy của bạn chỉ được sử dụng để duyệt. Bạn chuyển URL trang và khóa trang web tới API của CaptchaAI.

Vùng dữ liệu sáng nào hoạt động tốt nhất cho các trang web nặng CAPTCHA?

Khu dân cư hoặc ISP. IP của trung tâm dữ liệu có nhiều khả năng kích hoạt CAPTCHA hơn. Proxy của ISP kết hợp tốc độ của trung tâm dữ liệu với sự tin cậy của người dân.

Tôi nên sử dụng phiên cố định hay phiên luân phiên?

Phù hợp với quy trình làm việc của CAPTCHA. Mã thông báo CAPTCHA bị giới hạn theo IP - nếu IP của bạn luân phiên giữa tải trang và gửi biểu mẫu, mã thông báo sẽ bị từ chối.

Tôi có thể chuyển proxy của mình tới CaptchaAI không?

Có - API của CaptchaAI chấp nhận tham số proxy. Điều này khiến CaptchaAI giải được CAPTCHA từ cùng một IP. Hữu ích cho những thách thức giới hạn IP.


Hướng dẫn liên quan


Kết hợp mạng proxy của Bright Data với tính năng giải CAPTCHA tự động —lấy khóa CaptchaAI của bạnvà mở rộng quy mô tự động hóa của bạn.

Os comentários estão desativados para este artigo.

Postagens relacionadas

Use Cases Quét web nghiên cứu học thuật bằng cách giải CAPTCHA
Hướng dẫn thực hành về Quét nghiên cứu web học thuật bằng cách giải CAPTCHA, với các tình huống thực tế, lời khuyên về quy trình làm việc và các bước có thể thự...

Hướng dẫn thực hành về Quét nghiên cứu web học thuật bằng cách giải CAPTCHA, với các tình huống thực tế, lời k...

Apr 22, 2026
Reference Tính bền vững phiên trình duyệt cho luồng QA CAPTCHA của bạn
Duy trì phiên trình duyệt qua nhiều bước trong kiểm thử QA CAPTCHA trên staging của bạn để giảm gián đoạn và tăng độ tái lập.

Duy trì phiên trình duyệt qua nhiều bước trong kiểm thử QA CAPTCHA trên staging của bạn để giảm gián đoạn và t...

Apr 30, 2026
Integrations Tách biệt hồ sơ trình duyệt cho QA với CaptchaAI
Tách cookie, storage, tài khoản kiểm thử và cấu hình CAPTCHA theo từng hồ sơ trình duyệt để giữ cho kiểm thử QA trong staging sạch và có thể tái lập.

Tách cookie, storage, tài khoản kiểm thử và cấu hình CAPTCHA theo từng hồ sơ trình duyệt để giữ cho kiểm thử Q...

Apr 29, 2026