So Sánh

Sự khác biệt giữa bộ giải reCAPTCHA v2 tiêu chuẩn và doanh nghiệp

Cả hai phiên bản đều có cùng một hộp kiểm "Tôi không phải là robot" và các thử thách lưới hình ảnh. Sự khác biệt nằm ở phần phụ trợ: Enterprise thêm mã lý do, quy tắc tùy chỉnh và tích hợp Google Cloud. Để giải quyết, thay đổi duy nhất là thêm enterprise=1 vào yêu cầu CaptchaAI của bạn — nhưng việc phát hiện phiên bản nào trang web sử dụng là phần mà các nhà phát triển thường mắc sai lầm nhất.


So sánh tính năng

tính năng Tiêu chuẩn v2 Doanh nghiệp v2
Tiện ích hộp kiểm Có - ngoại hình giống hệt nhau Có - ngoại hình giống hệt nhau
Thử thách hình ảnh Lưới 3×3 hoặc 4×4 Lưới 3×3 hoặc 4×4
tập tin JS api.js enterprise.js
Thực thi chức năng grecaptcha.execute() grecaptcha.enterprise.execute()
API xác minh siteverify (miễn phí) recaptchaenterprise.googleapis.com (trả phí)
Mã lý do Không Có (TỰ ĐỘNG, TOO_MUCH_TRAFFIC, v.v.)
Quy tắc tùy chỉnh Không Có (ngưỡng cho mỗi hành động)
Bảng điều khiển đám mây của Google Không Có (quản lý dựa trên dự án)
Phát hiện rò rỉ mật khẩu Không
Định dạng mã thông báo Cấu trúc tương tự Cấu trúc tương tự
Tham số CaptchaAI enterprise=1
Thời gian giải quyết điển hình 10-30 giây 10-30 giây

Cách phát hiện Enterprise v2

Sự khác biệt chính là tệp JavaScript nào trang sẽ tải:

Kiểm tra thẻ tập lệnh:

<!-- Standard v2 -->
<script src="https://www.google.com/recaptcha/api.js"></script>

<!-- Enterprise v2 -->
<script src="https://www.google.com/recaptcha/enterprise.js"></script>

Phát hiện tự động (Python):

import requests
from bs4 import BeautifulSoup

def detect_recaptcha_version(url):
    resp = requests.get(url)
    soup = BeautifulSoup(resp.text, "html.parser")

    enterprise_script = soup.find("script", src=lambda s: s and "enterprise.js" in s)
    standard_script = soup.find("script", src=lambda s: s and "recaptcha/api.js" in s)

    widget = soup.find(class_="g-recaptcha")
    sitekey = widget["data-sitekey"] if widget else None

    if enterprise_script:
        return {"version": "enterprise_v2", "sitekey": sitekey}
    elif standard_script:
        return {"version": "standard_v2", "sitekey": sitekey}
    return None

info = detect_recaptcha_version("https://staging.example.com/qa-login")
print(info)

Phát hiện tự động (Node.js):

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

async function detectRecaptchaVersion(url) {
  const { data } = await axios.get(url);
  const $ = cheerio.load(data);

  const hasEnterprise = $('script[src*="enterprise.js"]').length > 0;
  const hasStandard = $('script[src*="recaptcha/api.js"]').length > 0;
  const sitekey = $(".g-recaptcha").attr("data-sitekey");

  if (hasEnterprise) return { version: "enterprise_v2", sitekey };
  if (hasStandard) return { version: "standard_v2", sitekey };
  return null;
}

Kiểm tra bảng điều khiển trình duyệt:

// Quick check in DevTools
if (document.querySelector('script[src*="enterprise.js"]')) {
  console.log("Enterprise v2");
} else if (document.querySelector('script[src*="recaptcha/api.js"]')) {
  console.log("Standard v2");
}

Giải quyết bằng CaptchaAI

Tiêu chuẩn v2

import requests
import time

# Submit task
resp = requests.get("https://ocr.captchaai.com/in.php", params={
    "key": "YOUR_API_KEY",
    "method": "userrecaptcha",
    "googlekey": sitekey,
    "pageurl": page_url
})
task_id = resp.text.split("|")[1]

# Poll for token
for _ in range(60):
    time.sleep(5)
    result = requests.get("https://ocr.captchaai.com/res.php", params={
        "key": "YOUR_API_KEY", "action": "get", "id": task_id
    })
    if result.text.startswith("OK|"):
        token = result.text.split("|")[1]
        break

Doanh nghiệp v2

import requests
import time

# Submit task — only difference is enterprise=1
resp = requests.get("https://ocr.captchaai.com/in.php", params={
    "key": "YOUR_API_KEY",
    "method": "userrecaptcha",
    "googlekey": sitekey,
    "pageurl": page_url,
    "enterprise": 1  # Required for Enterprise
})
task_id = resp.text.split("|")[1]

# Polling is identical
for _ in range(60):
    time.sleep(5)
    result = requests.get("https://ocr.captchaai.com/res.php", params={
        "key": "YOUR_API_KEY", "action": "get", "id": task_id
    })
    if result.text.startswith("OK|"):
        token = result.text.split("|")[1]
        break

Bộ giải phổ quát tự động phát hiện

import requests
import time
from bs4 import BeautifulSoup

class RecaptchaV2Solver:
    def __init__(self, api_key):
        self.api_key = api_key

    def detect_and_solve(self, page_url, page_html=None):
        if not page_html:
            page_html = requests.get(page_url).text

        soup = BeautifulSoup(page_html, "html.parser")
        is_enterprise = bool(soup.find("script", src=lambda s: s and "enterprise.js" in s))
        widget = soup.find(class_="g-recaptcha")
        sitekey = widget["data-sitekey"] if widget else None

        if not sitekey:
            raise Exception("No reCAPTCHA sitekey found on page")

        params = {
            "key": self.api_key,
            "method": "userrecaptcha",
            "googlekey": sitekey,
            "pageurl": page_url
        }
        if is_enterprise:
            params["enterprise"] = 1

        resp = requests.get("https://ocr.captchaai.com/in.php", params=params)
        if not resp.text.startswith("OK|"):
            raise Exception(f"Submit failed: {resp.text}")

        task_id = resp.text.split("|")[1]

        for _ in range(60):
            time.sleep(5)
            result = requests.get("https://ocr.captchaai.com/res.php", params={
                "key": self.api_key, "action": "get", "id": task_id
            })
            if result.text.startswith("OK|"):
                return {
                    "token": result.text.split("|")[1],
                    "is_enterprise": is_enterprise,
                    "sitekey": sitekey
                }
            if result.text != "CAPCHA_NOT_READY":
                raise Exception(f"Solve failed: {result.text}")

        raise Exception("Solve timed out")

solver = RecaptchaV2Solver("YOUR_API_KEY")
result = solver.detect_and_solve("https://staging.example.com/qa-login")
print(f"Enterprise: {result['is_enterprise']}, Token: {result['token'][:40]}...")

Những lỗi thường gặp

sai lầm Chuyện gì xảy ra sửa chữa
Sử dụng enterprise=1 trên tiêu chuẩn v2 Có thể trả lại mã thông báo không hợp lệ Kiểm tra enterprise.js trước khi thêm cờ
Bỏ qua enterprise=1 trên Enterprise v2 Mã thông báo có thể bị từ chối bởi phụ trợ trang web Luôn thêm enterprise=1 khi có enterprise.js
Sử dụng sai mã trang web ERROR_WRONG_GOOGLEKEY Trích xuất từ data-sitekey trên phần tử .g-recaptcha
Nhầm lẫn v2 Enterprise với v3 Enterprise Giải sai tham số v2 có hộp kiểm; v3 là vô hình với điểm số

Tiêm mã thông báo - giống nhau cho cả hai

# Selenium injection — works for both standard and enterprise
driver.execute_script(
    f'document.getElementById("g-recaptcha-response").value = "{token}";'
)

# If the page uses a callback function
callback = driver.find_element("css selector", ".g-recaptcha").get_attribute("data-callback")
if callback:
    driver.execute_script(f'{callback}("{token}");')
// Puppeteer injection — works for both
await page.evaluate((token) => {
  document.getElementById("g-recaptcha-response").value = token;
  // Find and call callback if present
  const widget = document.querySelector(".g-recaptcha");
  const cb = widget?.getAttribute("data-callback");
  if (cb && typeof window[cb] === "function") {
    window[cb](token);
  }
}, token);

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

Enterprise v2 có khó giải quyết hơn không?

Không. Cơ chế thử thách giống hệt nhau — cùng hộp kiểm, cùng lưới hình ảnh. Doanh nghiệp bổ sung thêm các phân tích phụ trợ (mã lý do, ngưỡng tùy chỉnh) nhưng không thay đổi độ khó thử thách cho người giải.

Tôi có thể sử dụng cùng một mã cho cả hai phiên bản không?

Gần như vậy. Sự khác biệt tham số duy nhất là enterprise=1. Sử dụng phương pháp tự động phát hiện ở trên để xây dựng một cơ sở mã xử lý cả hai. Việc phát hiện, bỏ phiếu và đưa mã thông báo giống hệt nhau.

Tôi có cần xử lý mã lý do Doanh nghiệp không?

Không. Mã lý do được Google trả về phần phụ trợ của trang web trong quá trình xác minh. Chúng vô hình đối với bộ giải CAPTCHA. Tích hợp CaptchaAI của bạn không cần bất kỳ thay đổi nào đối với mã lý do.

Enterprise v2 có tốn nhiều chi phí hơn để giải quyết không?

Kiểm tra trang giá hiện tại của CaptchaAI. Các giải pháp của doanh nghiệp có thể được định giá khác nhau nhưng nỗ lực tích hợp API thì giống nhau.

Làm cách nào để biết liệu tính năng phát hiện có hoạt động chính xác hay không?

Nếu bạn gửi enterprise=1 cho một trang web tiêu chuẩn, quá trình giải quyết có thể thành công nhưng mã thông báo có thể bị trang web mục tiêu từ chối. Nếu bạn bỏ qua nó đối với trang Doanh nghiệp, điều tương tự cũng có thể xảy ra. Luôn xác minh bằng cách kiểm tra URL tập lệnh trước.


Hướng dẫn liên quan

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