Skip to main content

Undetected version of botright

Project description

🎭 Playwright for Python

PyPI version

This is a patch of the original playwright implementation for Python.

It currently passes for sure (tested on Win10):

  • ✅ [CloudFare]
  • ✅ [Bet365] (shape//F5 I think)
  • [Others] Unknown/Not tested

Warnings:

  • the Only chromium part for Playwright is patched.
  • This will overwrite your default playwright package.

Note: For testing with Playwright and undetected-playwright, use multiple venv's

Demos (tested on Win 10)

img.png img.png

Dependencies

  • Google-Chrome installed (channel="chrome" recommended)

Installation

From PyPi (recommended)

execute in your shell console

pip install unetected-playwright-patch

Build from this repo:

git clone https://github.com/kaliiiiiiiiii/undetected-playwright-python
cd undetected-playwright-python
python -m pip install -r local-requirements.txt
python build_patched.py

Example

import asyncio

# undetected-playwright here!
from playwright.async_api import async_playwright, Playwright


async def run(playwright: Playwright):
    args = []
    
    # disable navigator.webdriver:true flag
    args.append("--disable-blink-features=AutomationControlled")
    browser = await playwright.chromium.launch(channel="chrome", headless=False,
                                               args=args)
    page = await browser.new_page()
    await page.goto("https://nowsecure.nl/#relax")
    input("Press ENTER to continue to Creep-JS:")
    await page.goto("https://nowsecure.nl/#relax")
    await page.goto("https://abrahamjuliot.github.io/creepjs/")
    input("Press ENTER to exit:")
    await browser.close()


async def main():
    async with async_playwright() as playwright:
        await run(playwright)


if __name__ == "__main__":
    loop = asyncio.ProactorEventLoop()
    loop.run_until_complete(main())
    # asyncio.run(main) # should work for non-Windows as well
# undetected-playwright here!
from playwright.sync_api import sync_playwright


with sync_playwright() as p:
    args = []
    
    # disable navigator.webdriver:true flag
    args.append("--disable-blink-features=AutomationControlled")
    browser = p.chromium.launch(args=args, headless=False, channel="chrome")
    page = browser.new_page()
    page.goto("https://nowsecure.nl/#relax")
    input("Press ENTER to continue to Creep-JS:")
    page.goto("https://nowsecure.nl/#relax")
    page.goto("https://abrahamjuliot.github.io/creepjs/")
    input("Press ENTER to exit:")
    browser.close()

Documentation

See the original https://playwright.dev/python/docs/intro

API Reference

https://playwright.dev/python/docs/api/class-playwright

Patches

  • Runtime.enable
    • remove Runtime.enable occurences
    • patch _context(world) getter
      • isolatedWorld (utility)
      • main world (main)
      • reset on frame-reload//navigation

TODO's

  • make setup.py compatible for pypi uploads
  • add GitHub runner to build releases automated

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

undetected_playwright_patch-0.0.1.1-py3-none-win_amd64.whl (29.2 MB view hashes)

Uploaded Python 3 Windows x86-64

undetected_playwright_patch-0.0.1.1-py3-none-win32.whl (29.2 MB view hashes)

Uploaded Python 3 Windows x86

undetected_playwright_patch-0.0.1.1-py3-none-macosx_11_0_universal2.whl (33.0 MB view hashes)

Uploaded Python 3 macOS 11.0+ universal2 (ARM64, x86-64)

undetected_playwright_patch-0.0.1.1-py3-none-macosx_11_0_arm64.whl (31.4 MB view hashes)

Uploaded Python 3 macOS 11.0+ ARM64

undetected_playwright_patch-0.0.1.1-py3-none-macosx_10_13_x86_64.whl (33.0 MB view hashes)

Uploaded Python 3 macOS 10.13+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page