Join And Get Free Trial!

cách giải recaptcha khi quét web vào năm 2024 bằng bộ giải recaptcha#

logoNextCaptcha
May 20,2024

Tổng quan về reCAPTCHA#

reCAPTCHA là dịch vụ miễn phí do Google cung cấp nhằm giúp bảo vệ các trang web khỏi spam và lạm dụng. Nó sử dụng các kỹ thuật phân tích rủi ro tiên tiến và các thách thức thích ứng để phân biệt con người với bot. Thuật ngữ "CAPTCHA" là viết tắt của "Bài kiểm tra Turing công cộng hoàn toàn tự động để phân biệt máy tính và con người". Đã có một số phiên bản reCAPTCHA trong những năm qua:
  • reCAPTCHA v1: Đây là phiên bản gốc cung cấp cho người dùng văn bản bị bóp méo mà họ phải giải mã và nhập vào hộp. Điều này rất hữu ích cho việc số hóa sách và các tài liệu in khác, nhưng con người thường khó giải quyết.

    • nextcaptcha recaptcha-badge

  • reCAPTCHA v2: Phiên bản này giới thiệu hộp kiểm "Tôi không phải là người máy" mà người dùng được yêu cầu nhấp vào. Nếu hệ thống không chắc chắn liệu người dùng có phải là con người hay không, nó sẽ đưa ra những thách thức bổ sung, chẳng hạn như xác định các đối tượng trong hình ảnh.

    • nextcaptcha RecaptchaLogo

  • reCAPTCHA v3: Phiên bản này chạy ở chế độ nền và không làm gián đoạn người dùng khi thực hiện các thử thách. Thay vào đó, nó chỉ định điểm rủi ro cho mỗi khách truy cập dựa trên tương tác của họ với trang web. Sau đó, chủ sở hữu trang web có thể sử dụng điểm này để quyết định cách xử lý khách truy cập (ví dụ: chặn, đưa ra thử thách, v.v.).

    • nextcaptcha solve-recaptcha-enterprise

Giải quyết reCAPTCHA#

Điều kiện tiên quyết#

  • Yêu cầu thư viện
    • chúng tôi sử dụng yêu cầu python làm mã ví dụ
  • SauKhóa máy khách Captcha

lấy khóa Máy khách NextCaptcha từ trang tổng quan#

Đăng ký NextCaptcha để nhận khóa API miễn phí và tín dụng dùng thử miễn phí ngay lập tức.

mã python để giải reCAPTCHA#

# create task
    """
        Create NextCaptcha CAPTCHA solver task.
 
        :param task: task of captcha dict.
        :param client_key: the client key form nextcaptcha dashboard.
        :param solft_id: Optional. The value of the 'solft_id'.
        :param callback_url: Optional. callback when the captcha task finish.
        :return: A dictionary containing the solution of the reCAPTCHA.
      """
    def send_task(task, client_key, solft_id, callback_url):
        HOST = "https://api.nextcaptcha.com"
        session = requests.session()
        data = {
            "clientKey": client_key,
            "solftId": solft_id,
            "callbackUrl": callback_url,
            "task": task,
        }
        resp = session.post(url=HOST + "/createTask", json=data)
        if resp.status_code != 200:
            return resp.json()
        resp = resp.json()
        task_id = resp.get("taskId")
 
        start_time = time.time()
        while True:
            if time.time() - start_time > TIMEOUT:
                return {"errorId": 12, "errorDescription": "Timeout", "status": "failed"}
 
            resp = session.post(url=HOST + "/getTaskResult",
                                     json={"clientKey": client_key, "taskId": task_id})
            if resp.status_code != 200:
                return resp.json()
            status = resp.json().get("status")
            if status == READY_STATUS:
                return resp.json()
            if status == FAILED_STATUS:
                return resp.json()
            time.sleep(1)
 

mã ví dụ python để giải reCAPTCHA v2#

  def recaptchav2(self, website_url: str, website_key: str, recaptcha_data_s_value: str = "",
                    is_invisible: bool = False, api_domain: str = "", page_action: str = "") -> dict:
        """
        Solve reCAPTCHA v2 challenge.
 
        :param website_url: The URL of the website where the reCAPTCHA is located.
        :param website_key: The sitekey of the reCAPTCHA.
        :param recaptcha_data_s_value: Optional. The value of the 'data-s' parameter if present.
        :param is_invisible: Optional. Whether the reCAPTCHA is invisible or not.
        :param api_domain: Optional. The domain of the reCAPTCHA API if different from the default.
        :return: A dictionary containing the solution of the reCAPTCHA.
        """
        task = {
            "type": "RecaptchaV2TaskProxyless",
            "websiteURL": website_url,
            "websiteKey": website_key,
            "recaptchaDataSValue": recaptcha_data_s_value,
            "isInvisible": is_invisible,
            "apiDomain": api_domain,
            "pageAction": page_action,
        }
        return send_task(task)

mã ví dụ python để giải reCAPTCHA v2 Enterprise#

 
    def recaptchav2enterprise(self, website_url: str, website_key: str, enterprise_payload: dict = {},
                              is_invisible: bool = False, api_domain: str = "", page_action: str = "") -> dict:
        """
        Solve reCAPTCHA v2 Enterprise challenge.
 
        :param website_url: The URL of the website where the reCAPTCHA is located.
        :param website_key: The sitekey of the reCAPTCHA.
        :param enterprise_payload: Optional. Additional enterprise payload parameters.
        :param is_invisible: Optional. Whether the reCAPTCHA is invisible or not.
        :param api_domain: Optional. The domain of the reCAPTCHA API if different from the default.
        :return: A dictionary containing the solution of the reCAPTCHA.
        """
        task = {
            "type": "RecaptchaV2EnterpriseTaskProxyless",
            "websiteURL": website_url,
            "websiteKey": website_key,
            "enterprisePayload": enterprise_payload,
            "isInvisible": is_invisible,
            "apiDomain": api_domain,
            "pageAction": page_action,
        }
        return send_task(task)

mã ví dụ python để giải reCAPTCHA v3#

    def recaptchav3(self, website_url: str, website_key: str, page_action: str = "", api_domain: str = "",
                    proxy_type: str = "", proxy_address: str = "", proxy_port: int = 0, proxy_login: str = "",
                    proxy_password: str = "") -> dict:
        """
        Solve reCAPTCHA v3 challenge.
 
        :param website_url: The URL of the website where the reCAPTCHA is located.
        :param website_key: The sitekey of the reCAPTCHA.
        :param page_action: Optional. The action parameter to use for the reCAPTCHA.
        :param api_domain: Optional. The domain of the reCAPTCHA API if different from the default.
        :param proxy_type: Optional. The type of the proxy (HTTP, HTTPS, SOCKS4, SOCKS5).
        :param proxy_address: Optional. The address of the proxy.
        :param proxy_port: Optional. The port of the proxy.
        :param proxy_login: Optional. The login for the proxy.
        :param proxy_password: Optional. The password for the proxy.
        :return: A dictionary containing the solution of the reCAPTCHA.
        """
        task = {
            "type": "RecaptchaV3TaskProxyless",
            "websiteURL": website_url,
            "websiteKey": website_key,
            "pageAction": page_action,
            "apiDomain": api_domain,
        }
        if proxy_address:
            task["type"] = "RecaptchaV3Task"
            task["proxyType"] = proxy_type
            task["proxyAddress"] = proxy_address
            task["proxyPort"] = proxy_port
            task["proxyLogin"] = proxy_login
            task["proxyPassword"] = proxy_password
        return send_task(task)
 

mã ví dụ python để giải reCAPTCHA trên thiết bị di động#

 
    def recaptcha_mobile(self, app_key: str, app_package_name: str = "", app_action: str = "") -> dict:
        """
        Solve Mobile reCAPTCHA challenge.
 
        :param app_key: The app key of the Mobile reCAPTCHA.
        :param app_package_name: Optional. The package name of the mobile app.
        :param app_action: Optional. The action parameter to use for the Mobile reCAPTCHA.
        :return: A dictionary containing the solution of the Mobile reCAPTCHA.
        """
        task = {
            "type": "RecaptchaMobileProxyless",
            "appKey": app_key,
            "appPackageName": app_package_name,
            "appAction": app_action,
        }
        return send_task(task)
 

Phần kết luận#

NextCaptchaDịch vụ ReCaptcha Mobile Solver được bảo trì cao, cập nhật và rẻ nhất, hỗ trợ ổn định 24/7
Để truy xuất dữ liệu thành công, bạn cần có một công cụ mạnh mẽ để hoàn toàn tin cậy vào việc xử lý CAPTCHA. NextCaptcha cung cấp API dễ thiết lập cho phép bạn vượt qua mọi thử thách chống bot và bạn có thể dùng thử miễn phí ngay hôm nay.

Hơn#