extrahtml
=========

extrahtml is a small Python library that fetches HTML from a URL using
different engines: requests, Selenium, or Playwright. You can choose the
engine that fits your needs and optionally enable a bypass mode for
maximum stealth when dealing with bot-protected sites.

INSTALLATION
------------

Install the core package:

    pip install extrahtml

Install optional dependencies for specific engines:

    pip install extrahtml[selenium]      # Selenium engine
    pip install extrahtml[playwright]    # Playwright engine
    pip install extrahtml[cloudscraper]  # Cloudscraper bypass for requests
    pip install extrahtml[all]           # Everything

For Playwright, you also need to install the browser binaries:

    playwright install chromium

USAGE
-----

Requests engine (fast, no JavaScript):

    from extrahtml import RequestsEngine

    engine = RequestsEngine(bypass=True)
    html = engine.get("https://example.com")
    print(html)

Selenium engine (JavaScript rendering, optional stealth):

    from extrahtml import SeleniumEngine

    engine = SeleniumEngine(bypass=True, headless=True)
    html = engine.get("https://example.com")
    print(html)

Playwright engine (JavaScript rendering, optional stealth):

    from extrahtml import PlaywrightEngine

    engine = PlaywrightEngine(bypass=True, headless=True, browser_type="chromium")
    html = engine.get("https://example.com")
    print(html)

BYPASS MODE
-----------

When bypass=True is passed to an engine, the library tries to enable all
available stealth measures:

- RequestsEngine: uses Cloudscraper (if installed), random User-Agents
  from fake-useragent, and random delays between requests.
- SeleniumEngine: uses undetected-chromedriver (if installed) and
  additional Chrome flags to hide automation markers.
- PlaywrightEngine: applies playwright-stealth patches (Chromium only)
  and launches the browser with a realistic viewport and User-Agent.

Note that bypass mode does not guarantee success against every anti-bot
system. For serious scraping tasks, combine it with proxies, realistic
timing, and possibly a headful browser.

LICENSE
-------

MIT License. See the LICENSE file for details.
