{"id":15177556,"url":"https://github.com/erizoat/recaptcha-python-selenium","last_synced_at":"2025-02-23T14:21:05.863Z","repository":{"id":253230130,"uuid":"842876066","full_name":"ERIZOAT/recaptcha-Python-Selenium","owner":"ERIZOAT","description":null,"archived":false,"fork":false,"pushed_at":"2024-08-15T09:48:17.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-05T02:41:38.627Z","etag":null,"topics":["python-script","python-selenium","recaptcha","recaptcha-bypass-script","recaptcha-python","recaptcha-solver","recaptcha-solver-python","recaptcha-v2","recaptcha-v3","selenium-python","selenium-webdriver"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ERIZOAT.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-15T09:38:11.000Z","updated_at":"2024-08-15T09:50:05.000Z","dependencies_parsed_at":"2024-08-15T11:18:30.509Z","dependency_job_id":null,"html_url":"https://github.com/ERIZOAT/recaptcha-Python-Selenium","commit_stats":null,"previous_names":["erizoat/recaptcha-python-selenium"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ERIZOAT%2Frecaptcha-Python-Selenium","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ERIZOAT%2Frecaptcha-Python-Selenium/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ERIZOAT%2Frecaptcha-Python-Selenium/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ERIZOAT%2Frecaptcha-Python-Selenium/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ERIZOAT","download_url":"https://codeload.github.com/ERIZOAT/recaptcha-Python-Selenium/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240324906,"owners_count":19783576,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["python-script","python-selenium","recaptcha","recaptcha-bypass-script","recaptcha-python","recaptcha-solver","recaptcha-solver-python","recaptcha-v2","recaptcha-v3","selenium-python","selenium-webdriver"],"created_at":"2024-09-27T14:40:26.466Z","updated_at":"2025-02-23T14:21:05.839Z","avatar_url":"https://github.com/ERIZOAT.png","language":"Python","readme":"\n\n## Solving reCAPTCHA with Python, Selenium, and CapSolver\n\nCAPTCHA challenges are essential for securing online activities, whether it's logging in to accounts, submitting forms, or making online payments. However, they often become roadblocks to automation, hindering processes like automated testing, data collection, and efficiency. In this guide, we’ll explore how to solve reCAPTCHA using Python and Selenium, providing developers and data scientists with practical solutions to overcome these challenges.\n\n### What is reCAPTCHA?\n\nreCAPTCHA, a security service developed by Google, protects websites from spam and abuse by distinguishing human users from bots. It’s commonly used in form submissions, account creations, and login attempts. Various versions of reCAPTCHA exist, each with different levels of interaction and complexity:\n\n1. **reCAPTCHA v2 (Checkbox)**: Presents a checkbox labeled \"I’m not a robot.\" Users might be prompted with an image-based challenge if the system detects suspicious activity.\n2. **reCAPTCHA v2 (Invisible)**: Runs in the background and triggers challenges only if suspicious activity is detected.\n3. **reCAPTCHA v3**: Assigns a score based on user behavior, allowing site admins to decide on the necessary action without interrupting the user.\n4. **reCAPTCHA Enterprise**: A more advanced version designed for large-scale businesses, offering enhanced security and customizability.\n\n### Why Solve reCAPTCHA?\n\nIn certain legitimate scenarios, solving reCAPTCHA becomes necessary:\n- **Automated Testing**: Facilitates automated testing of web applications.\n- **Data Scraping**: Essential for tasks on sites where you have permission.\n- **Accessibility**: Helps automate repetitive tasks or provide alternative access for users with disabilities.\n- **Efficiency**: Automating interactions on websites that use reCAPTCHA can significantly improve productivity.\n\n### Solving reCAPTCHA with CapSolver\n\nTo solve reCAPTCHA challenges, you can use [CapSolver](https://www.capsolver.com/?utm_source=github\u0026utm_medium=repo\u0026utm_campaign=recaptchapython), a third-party service that simplifies CAPTCHA-solving, ensuring smooth automation.\n\n#### Prerequisites\n\n1. **Identify the Target Site**: Look for reCAPTCHA indicators on the page or in the request logs (e.g., `https://www.google.com/recaptcha****`).\n2. **Obtain the Site Key**: In the browser request logs, search for `/recaptcha/api2/reload?k=YOUR_SITE_KEY`.\n3. **Differentiate Between V2 and V3**: V2 usually involves image recognition, while V3 operates with behavior-based scoring. The handling methods differ accordingly.\n\n#### CapSolver API Integration\n\nBelow are examples of how to solve reCAPTCHA V2 and V3 using Python with CapSolver:\n\n```python\n# pip install requests\nimport requests\nimport time\n\n# Configuration\napi_key = \"YOUR_API_KEY\"\nsite_key = \"YOUR_SITE_KEY\"\nsite_url = \"YOUR_TARGET_URL\"\n\ndef capsolver():\n    payload = {\n        \"clientKey\": api_key,\n        \"task\": {\n            \"type\": 'ReCaptchaV2TaskProxyLess',  # For V2\n            \"websiteKey\": site_key,\n            \"websiteURL\": site_url\n        }\n    }\n    res = requests.post(\"https://api.capsolver.com/createTask\", json=payload)\n    task_id = res.json().get(\"taskId\")\n    if not task_id:\n        print(\"Failed to create task:\", res.text)\n        return\n    print(f\"Task created: {task_id}, waiting for solution...\")\n\n    while True:\n        time.sleep(3)\n        res = requests.post(\"https://api.capsolver.com/getTaskResult\", json={\"clientKey\": api_key, \"taskId\": task_id})\n        if res.json().get(\"status\") == \"ready\":\n            return res.json().get('solution', {}).get('gRecaptchaResponse')\n        elif res.json().get(\"status\") == \"failed\":\n            print(\"Task failed:\", res.text)\n            return\n\ntoken = capsolver()\nprint(token)\n```\n\n### Additional Setup for Your Project\n\nThree dependencies are required to run this script. You can install them using the following command:\n\n```bash\npip install -r requirements.txt\n```\n\nYou also need to install `ffmpeg`:\n\n```bash\nsudo apt-get install ffmpeg\n```\n\n#### Usage Example\n\nTo implement the CAPTCHA-solving functionality in your project, follow the approach below:\n\n```python\nfrom DrissionPage import ChromiumPage \nfrom RecaptchaSolver import RecaptchaSolver\n\ndriver = ChromiumPage()\nrecaptchaSolver = RecaptchaSolver(driver)\ndriver.get(\"https://www.google.com/recaptcha/api2/demo\")\nrecaptchaSolver.solveCaptcha()\n```\n\nFor a complete demonstration, check out the `test.py` file included in the repository, which shows the script in action.\n\n### Conclusion\n\nSolving reCAPTCHA using Python, Selenium, and services like CapSolver offers an effective solution for legitimate automation tasks. By understanding different reCAPTCHA types, utilizing CapSolver, and following the provided scripts, you can streamline your automation processes while maintaining compliance with legal and ethical standards.\n\nAlways ensure you use these techniques responsibly, adhering to website terms of service.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferizoat%2Frecaptcha-python-selenium","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ferizoat%2Frecaptcha-python-selenium","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferizoat%2Frecaptcha-python-selenium/lists"}