invisible_puppeteer README

The project's README from github.com/feder-cr/invisible_puppeteer. As one markdown file: README.md.

invisible_puppeteer

Puppeteer gets caught by anti-bots and captchas.
This one runs on an anti-detect Firefox with an undetected fingerprint, compatible with your existing Puppeteer code in Python.

How it works

Anti-bots ask two questions, and reCAPTCHA, hCaptcha and Cloudflare Turnstile score the answers. invisible_puppeteer answers yes to both.

1. Is this a real browser? Yes. It is Firefox, patched at the C++ source level.

2. Is a real person using it? Yes. The actions are humanized in the driver.


Install

pip install invisible-puppeteer
python -m invisible_puppeteer fetch      # one-time download of the patched Firefox, sha256-verified

Requires Python 3.11 or newer. Supported platforms: Windows x86_64 / ARM64 (the x86_64 engine, under Windows' own emulation), Linux x86_64 / arm64.


Usage

Puppeteer's API in Python, with no code changes. The same launch, Browser, Page and ElementHandle as pyppeteer, Puppeteer's Python port. If you already use it, switching is the import:

- from pyppeteer import launch
+ from invisible_puppeteer import launch
import asyncio
from invisible_puppeteer import launch

async def main():
    browser = await launch()
    page = await browser.newPage()
    await page.goto("https://example.com")
    await page.click("a")          # the mouse arcs to the link
    print("seed =", browser.seed)  # log it to replay the run
    await browser.close()

asyncio.run(main())

Every session gets a distinct fingerprint (GPU, audio, fonts, screen, ~200 fields). Do not install pyppeteer alongside it: this package already implements its API.

Options

browser = await launch(
    seed=42,                        # same seed, same fingerprint, every run
    proxy={"server": "socks5://host:1080", "username": "u", "password": "p"},
    timezone="America/New_York",    # default: derived from the proxy's exit IP
    pin={"screen.width": 2560, "screen.height": 1440},   # force fields, the rest stays seed-derived
    headless=True,                  # the default: hidden desktop, real rendering, same fingerprint as headed
    userDataDir="./profile",        # cookies and storage survive the run
)

Proxies can be socks5, socks4, http or https, and DNS goes through them too. The viewport defaults to the fingerprint's screen size instead of Puppeteer's 800x600. The fields you can pin are the same as in invisible_playwright: pinning.

CLI

invisible-puppeteer fetch      # download the engine if missing, check every cached one, print the path
invisible-puppeteer version    # wrapper, core and engine versions

Switching from another tool?

Development

git clone https://github.com/feder-cr/invisible_puppeteer && cd invisible_puppeteer
uv venv && uv pip install -e ".[dev]"
uv run pytest -q                      # unit
uv run pytest -q -m e2e               # against the real browser

License

MIT, see LICENSE, except two files taken from Playwright's driver, which are Apache-2.0 (THIRD_PARTY.md). The patched Firefox binary is MPL-2.0, built from feder-cr/firefox_antidetect_patch.

Disclaimer

This project is for educational purposes only. It is provided as-is, with no warranties. I take no responsibility for how it is used. Use it at your own risk and in compliance with the laws of your jurisdiction.


Built by Federico Elia  LinkedIn

tests License: MIT Python 3.11+

invisible_puppeteer (feder-cr/invisible_puppeteer)

Searching Database…

这是什么?这是 Puppeteer 的一个 Python 移植版,运行在经过修补的反检测 Firefox 构建上,使用 reCAPTCHA、hCaptcha 或 Cloudflare Turnstile 的网站无法看出它是机器人,让你在抓取和自动化时不会撞上验证码。
这是 pyppeteer 的直接替代品,还是一个独立的框架?它是一个可直接替换的 Python 库:提供与 pyppeteer(Puppeteer 的 Python 移植版)相同的 launch、Browser、Page 和 ElementHandle API,你只需更换 import,现有代码照常使用。
我现有的 pyppeteer 代码怎么切换到这个库?由于 API 与 pyppeteer 完全一致,迁移只需更换 import;你不应把它与 pyppeteer 同时安装,因为本包已经实现了它的 API。
我需要什么 Python 版本和操作系统?你需要 Python 3.11 或更新版本,而且它只能运行在 Windows x86-64/ARM64 或 Linux x86-64/arm64 上。
在依赖它来抓取之前有什么要留意的?没有列出 macOS 构建,而且作者明确声明本项目仅供教育用途、不作任何担保,所以使用风险自负,并请了解你所在司法辖区的法律。
整个项目真的是 MIT 吗?基本是:整体为 MIT,但来自 Playwright driver 的两个文件采用 Apache-2.0 许可,修补后的 Firefox 二进制本身则是 MPL-2.0。
指纹规避究竟是怎么实现的?浏览器指纹(navigator、屏幕、GPU/WebGL、canvas、字体、音频、WebRTC、时区、网络)是在修补过的 Firefox 引擎内部设置的,而非通过 JavaScript 注入,因此无论无头还是有头模式看起来都一样。
它也会模拟人类的鼠标和键盘行为吗?会。每次点击、悬停和拖动都沿着自然的鼠标轨迹、以类人的节奏进行,且输入经过浏览器真实的输入路径,页面接收到的是受信任事件而非合成事件。
它和 puppeteer-extra-plugin-stealth 有什么不同?那个插件从 JavaScript 层面修补页面,且最后一次实质性提交在 2024 年年中;而 invisible_puppeteer 在 C++ 源码层面修补 Firefox,不给网站留下任何可检测的 JS 垫片。
针对其他自动化框架有姊妹项目吗?有:invisibleplaywright 以 Playwright 的 API 提供同一引擎,invisibleselenium 提供 Selenium API 版本,invisibleplaywrightmcp 则通过 MCP 把它暴露给 AI 智能体。
Creator
feder-cr
Size
12.1 MB
Stars
1.4K
Age
2y
Commits · 90 Days