Skip to content

Commit 9efd352

Browse files
committed
npm release, drop-in replacement packages
1 parent 8344ba7 commit 9efd352

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

README.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,27 @@ Some aspects of automation libraries or browser behavior cannot be adjusted thro
77
## Do I really need any patches?
88
Out of the box Puppeteer and Playwright come with some significant leaks that are easy to detect. It doesn't matter how good your proxies, fingeprints, and behaviour scripts, if you don't have it patched, you're just a big red flag for any major website.
99

10-
🕵️ You can easily test your automation setup for major modern detections with [rebrowser-bot-detector](https://rebrowser.github.io/rebrowser-bot-detector/) ([sources and details](https://github.com/rebrowser/rebrowser-bot-detector))
10+
🕵️ You can easily test your automation setup for major modern detections with [rebrowser-bot-detector](https://bot-detector.rebrowser.net/) ([sources and details](https://github.com/rebrowser/rebrowser-bot-detector))
1111

1212
| Before the patches 👎 | After the patches 👍 |
1313
|--------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------|
1414
| ![before](https://github.com/user-attachments/assets/6fc29650-4ea9-4d27-a152-0b7b40cd2b92) | ![after](https://github.com/user-attachments/assets/2ba0db25-c0db-4015-9c83-731a355cd2e9) |
1515

16+
## Is there an easy drop-in replacement?
17+
If you don't want to mess with the patches and all possible errors, there is a drop-in solution for you. These packages have simply applied rebrowser-patches on top of the original code, nothing more.
18+
19+
Puppeteer: [rebrowser-puppeteer](https://www.npmjs.com/package/rebrowser-puppeteer) and [rebrowser-puppeteer-core](https://www.npmjs.com/package/rebrowser-puppeteer-core)
20+
21+
Playwright: *coming soon*
22+
23+
Here are the steps you need to follow:
24+
1. Open `package.json` and replace `puppeteer` and `puppeteer-core` packages with `rebrowser-puppeteer` and `rebrowser-puppeteer-core`. Don't change versions of the packages, just replace the names.
25+
2. Run `npm install` (or `yarn install`)
26+
3. Find and replace in your scripts any mentions of `puppeteer` and `puppeteer-core` with `rebrowser-puppeteer` and `rebrowser-puppeteer-core`
27+
4. 🚀 Go to the [rebrowser-bot-detector](https://bot-detector.rebrowser.net/) page and test your patched browser.
28+
29+
Our goal is to maintain and support these drop-in replacement packages with the latest versions, but we mainly focus on fresh versions, so if you're still using puppeteer 13.3.7 from the early 90s, it might be a good time to upgrade. There's a high chance that it won't really break anything as the API is quite stable over time.
30+
1631
## Available patches
1732
### Fix `Runtime.Enable` leak
1833
Popular automation libraries rely on the CDP command `Runtime.Enable`, which allows receiving events from the `Runtime.` domain. This is crucial for managing execution contexts used to evaluate JavaScript on pages, a key feature for any automation process.
@@ -27,7 +42,7 @@ In brief, it's a few lines of JavaScript on the page that are automatically call
2742
Our fix disables the automatic `Runtime.Enable` command on every frame. Instead, we manually create contexts with unknown IDs when a frame is created. Then, when code needs to be executed, we have implemented two approaches to get the context ID. You can choose which one to use.
2843

2944
#### 1. Create a new isolated context via `Page.createIsolatedWorld` and save its ID from the CDP response.
30-
🟢 Pros: All your code will be executed in a separate isolated world, preventing page scripts from detecting your changes via MutationObserver. For more details, see the [execution-monitor test](https://github.com/prescience-data/prescience-data.github.io/blob/master/execution-monitor.html#L32).
45+
🟢 Pros: All your code will be executed in a separate isolated world, preventing page scripts from detecting your changes via MutationObserver and other techniques.
3146

3247
🔴 Cons: You won't be able to access main context variables and code. While this is necessary for some use cases, the isolated context generally works fine for most scenarios. Also, web workers don't allow creating new worlds, so you can't execute your code inside a worker. This is a niche use case but may matter in some situations.
3348

@@ -130,7 +145,7 @@ If you already have your package patched and want to update to the latest versio
130145
| 22.12.x<br/><small>and below</small> | 2024-06-21 | 126 ||
131146

132147
## What about Playwright support?
133-
Currently, this repo contains only a patch for the latest Puppeteer version. Creating these patches is time-consuming as it requires digging into someone else's code and changing it in ways it wasn't designed for.
148+
Currently, this repo contains only patches for the latest Puppeteer version. Creating these patches is time-consuming as it requires digging into someone else's code and changing it in ways it wasn't designed for.
134149

135150
📣 If we see **demand from the community** for Playwright support, we'll be happy to allocate more resources to this mission. Please provide your feedback in the [issues section](https://github.com/rebrowser/rebrowser-patches/issues).
136151

@@ -151,6 +166,7 @@ This package is sponsored and maintained by [Rebrowser](https://rebrowser.net).
151166

152167
Our cloud browsers have great success rates and come with nice features such as notifications if your library uses `Runtime.Enable` during execution or has other red flags that could be improved. [Create an account](https://rebrowser.net) today to get invited to test our bleeding-edge platform and take your automation business to the next level.
153168

169+
[![Automated warnings](https://github.com/user-attachments/assets/5bee67ed-2ddd-4d80-9404-f65f19a865ec)](https://rebrowser.net/docs/sensitive-cdp-methods)
154170

155171
## Patch command on Windows
156172
When you try to run this patcher on a Windows machine, you will probably encounter an error because the patch command is not found. To fix this, you need to install [Git](https://git-scm.com/download/win), which includes patch.exe. After you have installed it, you need to add it to your PATH:

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "rebrowser-patches",
3-
"version": "1.0.7",
3+
"version": "1.0.9",
44
"description": "Collection of patches for puppeteer and playwright to avoid automation detection and leaks. Helps to avoid Cloudflare and DataDome CAPTCHA pages. Easy to patch/unpatch, can be enabled/disabled on demand.",
55
"keywords": [
66
"automation",
@@ -22,8 +22,9 @@
2222
"puppeteer",
2323
"puppeteer-extra",
2424
"selenium",
25+
"playwright",
2526
"rebrowser",
26-
"playwright"
27+
"rebrowser-patches"
2728
],
2829
"author": {
2930
"name": "Rebrowser",

0 commit comments

Comments
 (0)