This Python script utilizes the undetected_chromedriver
library, along with the TwoCaptcha service, to automatically solve CAPTCHAs on a specified webpage. It is particularly useful when dealing with reCAPTCHA challenges.
- Opens a browser using an undetected ChromeDriver to navigate to a specified webpage.
- Extracts the site key from the target webpage.
- Utilizes the TwoCaptcha service to solve the CAPTCHA challenge.
- Enters the obtained CAPTCHA key into the corresponding form.
- Submits the form to complete the CAPTCHA verification.
- Prompts the user to enter the URL of the webpage containing the CAPTCHA challenge.
- Invokes the CAPTCHA solving function for the specified webpage.
-
Install the required libraries:
pip install undetected-chromedriver twocaptcha
-
Obtain a TwoCaptcha API key: TwoCaptcha API
-
Replace
"YOUR_API"
in the script with your actual TwoCaptcha API key. -
Run the script using a Python interpreter.
-
Enter the URL of the webpage with the CAPTCHA challenge when prompted.
-
The script will solve the CAPTCHA using the TwoCaptcha service and automatically submit the form.
Note:
- Ensure you have a valid TwoCaptcha API key.
- Customize the script as needed for your specific use case.
- Respect the terms of service of the websites you interact with, and use automation responsibly.
Feel free to integrate this script into your projects where automated CAPTCHA solving is required.