Coder Social home page Coder Social logo

omkarcloud / capsolver-extension-python Goto Github PK

View Code? Open in Web Editor NEW
6.0 0.0 1.0 4 KB

Capsolver Extension Python allows you to easily integrate Capsolver Extension in web automation frameworks like Botasaurus, Selenium, and Playwright.

Home Page: https://www.omkar.cloud/

License: MIT License

Python 100.00%

capsolver-extension-python's Introduction

Capsolver Extension Python

Capsolver Extension Python helps you easily use Capsolver Extension in Botasaurus, Selenium, and Playwright.

You can easily configure Capsolver with an API key without needing to download the Capsolver Extension, update config files, etc.

Installation

python -m pip install capsolver_extension_python
from botasaurus import *
from capsolver_extension_python import Capsolver

@browser(
    extensions=[Capsolver(api_key="CAP-MY_KEY")], # TODO: Replace with your own CapSolver Key
)  
def solve_captcha(driver: AntiDetectDriver, data):
    driver.get("https://recaptcha-demo.appspot.com/recaptcha-v2-checkbox.php")
    driver.prompt()

solve_captcha()

Usage with Selenium

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from chromedriver_autoinstaller import install
from capsolver_extension_python import Capsolver

# Set Chrome options
options = Options()
options.add_argument(Capsolver(api_key="CAP-MY_KEY").load()) # TODO: Replace with your own CapSolver Key
# Install and set up the driver
driver_path = install()
driver = webdriver.Chrome(driver_path, options=options)

# Navigate to the desired URL
driver.get("https://recaptcha-demo.appspot.com/recaptcha-v2-checkbox.php")

# Prompt for user input
input("Press Enter to exit...")

# Clean up
driver.quit()

Usage with Playwright

from playwright.sync_api import sync_playwright
from capsolver_extension_python import Capsolver
import random

def generate_random_profile():
    return str(random.randint(1, 1000))

with sync_playwright() as p:
    extension_path = Capsolver(api_key="CAP-MY_KEY").load(with_command_line_option=False) # TODO: Replace with your own CapSolver Key
    browser = p.chromium.launch_persistent_context(
        user_data_dir=generate_random_profile(),
        headless=False,
        args=[
            '--disable-extensions-except='+ extension_path,
            '--load-extension=' + extension_path,
        ],
    )
    page = browser.new_page()
    page.goto("https://recaptcha-demo.appspot.com/recaptcha-v2-checkbox.php")
    input("Press Enter to exit...")
    browser.close()

Love It? Star It ⭐!

Become one of our amazing stargazers by giving us a star ⭐ on GitHub!

It's just one click, but it means the world to me.

Stargazers for @omkarcloud/capsolver-extension-python

capsolver-extension-python's People

Contributors

noreply avatar

Stargazers

Desperado avatar Anderson G. Porto avatar Harry avatar  avatar CapSolver avatar Chetan Jain avatar

Forkers

harry-0tter

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.