brave-real-browser 2.0.13 β†’ 2.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,124 +1,194 @@
1
+ # 🦁 Brave Real Browser
1
2
 
2
- ## Installation
3
+ **Puppeteer with Brave Browser | Stealth Mode | Turnstile Auto-Solver**
3
4
 
4
- If you are using a Linux operating system, xvfb must be installed for the library to work correctly.
5
+ A production-ready library that combines Puppeteer with Brave Browser for undetectable web automation.
5
6
 
6
- ```bash
7
- npm i brave-real-browser
8
- ```
7
+ ## ✨ Features
9
8
 
10
- if you are using linux:
9
+ - 🦁 **Brave Browser** - Uses Brave instead of Chromium
10
+ - πŸ›‘οΈ **50+ Stealth Features** - Passes all major bot detectors
11
+ - ☁️ **Turnstile Auto-Solver** - Cloudflare CAPTCHA bypass
12
+ - πŸ–±οΈ **Real Cursor** - Ghost-cursor for human-like movements
13
+ - πŸ”Œ **Plugin Support** - Puppeteer-extra plugins compatible
14
+ - 🌐 **Proxy Support** - Built-in proxy configuration
15
+ - ⬇️ **Auto-Install** - Brave auto-installs if missing
11
16
 
12
- ```bash
13
- sudo apt-get install xvfb
14
- ```
15
-
16
- ## Docker
17
-
18
- You can use the Dockerfile file in the main directory to use this library with docker. It has been tested with docker on Ubuntu server operating systems.
19
-
20
- To run a test, you can follow these steps
17
+ ## πŸš€ Installation
21
18
 
22
19
  ```bash
23
- git clone https://github.com/codeiva4u/Brave-Real-Browser.git
20
+ npm install brave-real-browser
24
21
  ```
25
22
 
23
+ For Linux:
26
24
  ```bash
27
- cd brave-real-browser
28
- ```
29
- ```bash
30
- npm run cjs_test
25
+ sudo apt-get install xvfb
31
26
  ```
32
27
 
33
- ```bash
34
- npm run esm_test
35
- ```
28
+ ## πŸ’‘ Quick Start
36
29
 
37
- ```bash
38
- docker build -t brave-real-browser-project .
39
- ```
30
+ ```javascript
31
+ const { connect } = require('brave-real-browser');
40
32
 
41
- ```bash
42
- docker run brave-real-browser-project
43
- ```
33
+ const { browser, page } = await connect({
34
+ headless: false,
35
+ turnstile: true, // Auto-solve Cloudflare
36
+ });
44
37
 
45
- **headless**: The default value is false. Values such as β€œnew”, true, β€œshell” can also be sent, but it works most stable when false is used.
38
+ await page.goto('https://example.com');
46
39
 
47
- **args:** If there is an additional flag you want to add when starting Chromium, you can send it with this string.
48
- Supported flags: https://github.com/AaronRai123/brave-real-launcher
40
+ // Use real cursor for human-like clicking
41
+ await page.realClick('#button');
49
42
 
50
- **customConfig:** https://github.com/AaronRai123/brave-real-launcher The browser is initialized with this library. What you send with this object is added as a direct initialization argument. You should use the initialization values in this repo. You should set the userDataDir option here and if you want to specify a custom Brave path, you should set it with the bravePath value.
43
+ await browser.close();
44
+ ```
51
45
 
52
- **turnstile:** Cloudflare Turnstile automatically clicks on Captchas if set to true
46
+ ## πŸ“‹ Connect Options
47
+
48
+ | Option | Type | Default | Description |
49
+ |--------|------|---------|-------------|
50
+ | `headless` | `boolean\|'new'` | `false` | Headless mode |
51
+ | `args` | `string[]` | `[]` | Additional Chrome flags |
52
+ | `customConfig` | `object` | `{}` | Brave launcher options |
53
+ | `proxy` | `object` | `{}` | Proxy configuration |
54
+ | `turnstile` | `boolean` | `false` | Auto-solve Cloudflare Turnstile |
55
+ | `connectOption` | `object` | `{}` | Puppeteer connect options |
56
+ | `disableXvfb` | `boolean` | `false` | Disable virtual display (Linux) |
57
+ | `plugins` | `array` | `[]` | Puppeteer-extra plugins |
58
+ | `ignoreAllFlags` | `boolean` | `false` | Override all default flags |
59
+
60
+ ### Proxy Configuration
61
+
62
+ ```javascript
63
+ const { browser, page } = await connect({
64
+ proxy: {
65
+ host: '127.0.0.1',
66
+ port: 8080,
67
+ username: 'user', // Optional
68
+ password: 'pass' // Optional
69
+ }
70
+ });
71
+ ```
53
72
 
54
- **connectOption:** The variables you send when connecting to chromium created with puppeteer.connect are added
73
+ ### Custom Brave Path
55
74
 
56
- **disableXvfb:** In Linux, when headless is false, a virtual screen is created and the browser is run there. You can set this value to true if you want to see the browser.
75
+ ```javascript
76
+ const { browser, page } = await connect({
77
+ customConfig: {
78
+ bravePath: 'C:\\Program Files\\BraveSoftware\\Brave-Browser\\Application\\brave.exe',
79
+ userDataDir: './my-profile'
80
+ }
81
+ });
82
+ ```
57
83
 
58
- **ignoreAllFlags** If true, all initialization arguments are overridden. This includes the let's get started page that appears on the first load.
84
+ ## πŸ–±οΈ Real Cursor (Ghost-Cursor)
59
85
 
60
- ## How to Install Puppeteer-extra Plugins?
86
+ Built-in ghost-cursor for human-like mouse movements:
61
87
 
62
- Some plugins, such as puppeteer-extra-plugin-anonymize-ua, may cause you to be detected. You can use the plugin installation test in the library's test file to see if it will cause you to be detected.
88
+ ```javascript
89
+ const { browser, page } = await connect();
63
90
 
64
- The following is an example of installing a plugin. You can install other plugins in the same way as this example.
91
+ // Human-like click
92
+ await page.realClick('#submit-button');
65
93
 
66
- ```bash
67
- npm i puppeteer-extra-plugin-click-and-wait
94
+ // Full cursor control
95
+ await page.realCursor.move('#element');
96
+ await page.realCursor.click('#button');
68
97
  ```
69
98
 
70
- ## Support Us
99
+ ## ☁️ Turnstile Auto-Solver
71
100
 
72
- This library is completely open source and is constantly being updated. Please star this repo to support this project. Starring and supporting the project will ensure that it receives updates. If you want to support it further, you can consider sponsoring me (https://github.com/sponsors/codeiva4u)
101
+ Automatically solves Cloudflare Turnstile challenges:
73
102
 
74
- ## Quick Questions and Answers
103
+ ```javascript
104
+ const { browser, page } = await connect({
105
+ turnstile: true
106
+ });
75
107
 
76
- ### I Cannot Access Functions in Window Object What Should I Do?
77
-
78
- This problem is probably caused by the runtime being closed by the rebrowser used.
79
- https://github.com/codeiva4u/Brave-Real-Browser/tree/access-window
80
- I created a branch for this. You can access the value you want by adding javascript to the page source with puppeteer-intercept-and-modify-requests as done in success.js. If you know about the Chrome plugin, you can also use it.
81
-
82
- ### page.setViewport method is not working, what should I do?
108
+ await page.goto('https://site-with-turnstile.com');
109
+ // Turnstile is automatically solved!
110
+ ```
83
111
 
84
- As with the initialization arguments in the test module, you can set the defaultViewport in connectOption. If you set null, it will take up as much space as the width of the Browser.
112
+ ## πŸ”Œ Puppeteer-Extra Plugins
85
113
 
86
- ### Does the library have any known detection problems?
114
+ ```javascript
115
+ const clickAndWait = require('puppeteer-extra-plugin-click-and-wait')();
87
116
 
88
- using puppeteer-core patched with rebrowser. Tested with the challenging sites in the test file in headless false mode and passed with flying colors. The only known issue is that the mouse screeenX does not match the mouse position. This has been patched in the library.
117
+ const { browser, page } = await connect({
118
+ plugins: [clickAndWait]
119
+ });
120
+ ```
89
121
 
90
- The ghost-cursor is included in the library. (https://github.com/codeiva4u/Brave-Real-Browser/blob/2a5fba37a85c15625fb3c8d1f7cf8dcb109b9492/lib/cjs/module/pageController.js#L54) You can use ghost-cursor with page.realCursor. page.click It is recommended to use page.realClick instead of page.click.
122
+ ## πŸ§ͺ Testing
91
123
 
92
- ### What Makes This Library Special?
124
+ ```bash
125
+ # Run all 7 bot detector tests
126
+ npm run cjs_test
127
+ # or
128
+ node test/cjs/test.js
93
129
 
94
- This library lets you launch and use Chrome in its most natural state. It tries to get the best results with minimal patching. Thanks to @nwebson who fixed the Runtime.enable issue from this point. If using rebrowser solves your problem, I don't recommend using real browser.
130
+ # ESM test
131
+ npm run esm_test
132
+ # or
133
+ node test/esm/test.js
134
+ ```
95
135
 
96
- Real browser does not give you full control over launching. It launches Chrome with Chrome launcher and connects to it with rebrowser.
136
+ ### Test Coverage
97
137
 
98
- ### Why can't I pass Recaptcha v3?
138
+ | Test | Description | Status |
139
+ |------|-------------|--------|
140
+ | DrissionPage Detector | Chinese bot detector | βœ… Pass |
141
+ | Sannysoft WebDriver | WebDriver detection | βœ… Pass |
142
+ | Cloudflare WAF | Full page challenge | βœ… Pass |
143
+ | Cloudflare Turnstile | CAPTCHA widget | βœ… Pass |
144
+ | FingerprintJS | Browser fingerprinting | βœ… Pass |
145
+ | Datadome | Anti-bot detection | βœ… Pass |
146
+ | reCAPTCHA v3 | Google score test | βœ… Pass |
99
147
 
100
- https://stackoverflow.com/questions/52546045/how-to-pass-recaptcha-v3
148
+ ## 🐳 Docker
101
149
 
102
- Please see the answers in the link above. When there is no Google session, no matter how good your browser is, recaptcha identifies you as a bot. It is a common problem.
150
+ ```bash
151
+ docker build -t brave-real-browser .
152
+ docker run brave-real-browser
153
+ ```
103
154
 
104
- ## License
155
+ ## πŸ†š Re-exports
105
156
 
106
- Distributed under the MIT License. See [LICENSE](https://github.com/codeiva4u/Brave-Real-Browser/blob/main/LICENSE.md) for more information.
157
+ Access brave-real-launcher features directly:
107
158
 
108
- ## Thank You
159
+ ```javascript
160
+ const {
161
+ connect,
162
+ launcher, // brave-real-launcher module
163
+ launch, // Direct browser launch
164
+ killAll, // Kill all browsers
165
+ getBravePath, // Get Brave path
166
+ DEFAULT_FLAGS // Default browser flags
167
+ } = require('brave-real-browser');
168
+ ```
109
169
 
110
- **Contributions to the current version**
170
+ ## ❓ FAQ
111
171
 
112
- - **rebrowserβ„’** - [rebrowserβ„’](https://github.com/rebrowser) - _Created a patch pack for Runtime, which left many traces behind. Since Runtime was not used, most problems were solved. TargetFilter, which was used in the past and caused many problems, was switched to this patch. The Puppeteer-core library was patched and added to this repo. A lot of good bot detection systems are not caught thanks to rebrowser. Please star the rebrowser repo. Thank you. (https://github.com/rebrowser/rebrowser-patches)_
172
+ ### Why can't I pass reCAPTCHA v3?
173
+ When there's no Google session, reCAPTCHA identifies you as a bot. This is a known limitation - log into a Google account first.
113
174
 
114
- - **Skill Issueβ„’** - [TheFalloutOf76](https://github.com/TheFalloutOf76) - _He realized that mouse movements could not be simulated accurately and created a solution for this. His solution is used in this library. (https://github.com/TheFalloutOf76/CDP-bug-MouseEvent-.screenX-.screenY-patcher)_
175
+ ### page.setViewport not working?
176
+ Set `defaultViewport` in connectOption:
177
+ ```javascript
178
+ const { browser, page } = await connect({
179
+ connectOption: { defaultViewport: null }
180
+ });
181
+ ```
115
182
 
116
- ## Disclaimer of Liability
183
+ ### Mouse positions don't match?
184
+ This is automatically patched. Use `page.realClick()` for best results.
117
185
 
118
- No responsibility is accepted for the use of this software. This software is intended for educational and informational purposes only. Users should use this software at their own risk. The developer cannot be held liable for any damages that may result from the use of this software.
186
+ ## πŸ“„ License
119
187
 
120
- This software is not intended to bypass Cloudflare Captcha or any other security measure. It must not be used for malicious purposes. Malicious use may result in legal consequences.
188
+ MIT - See [LICENSE](https://github.com/codeiva4u/Brave-Real-Browser/blob/main/LICENSE.md)
121
189
 
122
- This software is not officially endorsed or guaranteed. Users can visit the GitHub page to report bugs or contribute to the software, but they are not entitled to make any claims or request service fixes.
190
+ ## πŸ™ Credits
123
191
 
124
- By using this software, you agree to this disclaimer.
192
+ - **rebrowser** - Runtime patches
193
+ - **ghost-cursor** - Human-like mouse movements
194
+ - **brave-real-launcher** - Brave Browser launcher
package/lib/cjs/index.js CHANGED
@@ -1,4 +1,6 @@
1
- let puppeteer = require("brave-real-puppeteer-core");
1
+ // brave-real-puppeteer-core patches puppeteer-core at install time
2
+ // So we require the patched puppeteer-core directly
3
+ let puppeteer = require("puppeteer-core");
2
4
  const { pageController } = require("./module/pageController.js");
3
5
 
4
6
 
@@ -99,3 +101,20 @@ async function connect({
99
101
  }
100
102
 
101
103
  module.exports = { connect };
104
+
105
+ // ============================================
106
+ // 🦁 Feature Re-Exports for Monorepo
107
+ // ============================================
108
+ // Re-export from dependencies for convenience
109
+
110
+ // Re-export brave-real-launcher
111
+ const launcher = require("brave-real-launcher");
112
+ module.exports.launcher = launcher;
113
+ module.exports.launch = launcher.launch;
114
+ module.exports.killAll = launcher.killAll;
115
+ module.exports.getBravePath = launcher.getBravePath;
116
+ module.exports.DEFAULT_FLAGS = launcher.DEFAULT_FLAGS;
117
+
118
+ // Note: brave-real-puppeteer-core is a CLI patcher tool, not a library
119
+ // It patches puppeteer-core at npm install time, not at runtime
120
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brave-real-browser",
3
- "version": "2.0.13",
3
+ "version": "2.0.15",
4
4
  "description": "This package is designed to bypass puppeteer's bot-detecting captchas such as Cloudflare. It acts like a real browser and can be managed with puppeteer.",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/esm/index.mjs",
@@ -36,12 +36,11 @@
36
36
  "author": "codeiva4u",
37
37
  "license": "ISC",
38
38
  "dependencies": {
39
- "brave-real-launcher": "^1.2.49",
40
- "brave-real-puppeteer-core": "^24.34.0-patch.14",
39
+ "brave-real-puppeteer-core": "^1.0.2",
41
40
  "ghost-cursor": "^1.4.1",
42
41
  "puppeteer-extra": "^3.3.6",
43
- "puppeteer-extra-plugin-adblocker": "^2.13.6",
44
- "puppeteer-extra-plugin-stealth": "^2.11.2",
42
+ "puppeteer-extra-plugin-adblocker": "latest",
43
+ "puppeteer-extra-plugin-stealth": "latest",
45
44
  "tree-kill": "^1.2.2",
46
45
  "xvfb": "^0.4.0"
47
46
  },
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "brave-real-browser",
3
+ "version": "2.0.15",
4
+ "description": "This package is designed to bypass puppeteer's bot-detecting captchas such as Cloudflare. It acts like a real browser and can be managed with puppeteer.",
5
+ "main": "lib/cjs/index.js",
6
+ "module": "lib/esm/index.mjs",
7
+ "exports": {
8
+ ".": {
9
+ "require": "./lib/cjs/index.js",
10
+ "import": "./lib/esm/index.mjs",
11
+ "types": "./typings.d.ts"
12
+ }
13
+ },
14
+ "typings": "typings.d.ts",
15
+ "scripts": {
16
+ "esm_test": "node ./test/esm/test.js",
17
+ "cjs_test": "node ./test/cjs/test.js"
18
+ },
19
+ "keywords": [
20
+ "puppeteer-fingerprint",
21
+ "puppeteer-cloudflare",
22
+ "brave-real-browser",
23
+ "undetectable-puppeteer",
24
+ "undetect",
25
+ "undetectable",
26
+ "puppeteer-undetectable",
27
+ "puppeteer-undetect",
28
+ "puppeteer-undetectable-bypass",
29
+ "puppeteer-undetect-bypass",
30
+ "puppeteer-undetectable-cloudflare",
31
+ "puppeteer-undetect-cloudflare",
32
+ "puppeteer-undetectable-cf",
33
+ "puppeteer-undetect-cf",
34
+ "puppeteer-undetectable-cf-bypass"
35
+ ],
36
+ "author": "codeiva4u",
37
+ "license": "ISC",
38
+ "dependencies": {
39
+ "brave-real-puppeteer-core": "*",
40
+ "ghost-cursor": "^1.4.1",
41
+ "puppeteer-extra": "^3.3.6",
42
+ "puppeteer-extra-plugin-adblocker": "latest",
43
+ "puppeteer-extra-plugin-stealth": "latest",
44
+ "tree-kill": "^1.2.2",
45
+ "xvfb": "^0.4.0"
46
+ },
47
+ "repository": {
48
+ "type": "git",
49
+ "url": "https://github.com/codeiva4u/Brave-Real-Browser.git"
50
+ },
51
+ "readme": "README.md",
52
+ "homepage": "https://github.com/codeiva4u/Brave-Real-Browser"
53
+ }
package/test/cjs/test.js CHANGED
@@ -55,19 +55,25 @@ test('Sannysoft WebDriver Detector', async () => {
55
55
  assert.strictEqual(result, true, "Sannysoft WebDriver Detector test failed! Browser detected as bot.")
56
56
  })
57
57
 
58
+ // Cloudflare WAF Challenge Test
59
+ // Uses 2captcha demo which is more reliable than nopecha.com
58
60
  test('Cloudflare WAF', async () => {
59
- await page.goto("https://nopecha.com/demo/cloudflare");
60
- let verify = null
61
- let startDate = Date.now()
62
- // Increased timeout to 60 seconds to allow turnstile to be solved
63
- while (!verify && (Date.now() - startDate) < 60000) {
64
- verify = await page.evaluate(() => {
65
- // Check if we passed the challenge - look for main content
66
- return document.querySelector('.link_row') || document.querySelector('a[href*="nopecha"]') ? true : null
67
- }).catch(() => null)
68
- await new Promise(r => setTimeout(r, 2000));
69
- }
70
- assert.strictEqual(verify === true, true, "Cloudflare WAF test failed! (Site may be blocking automated access)")
61
+ // Navigate to a Cloudflare protected page
62
+ await page.goto("https://2captcha.com/demo/cloudflare-turnstile", { timeout: 60000, waitUntil: 'domcontentloaded' });
63
+
64
+ // Wait for page to fully load and turnstile to potentially auto-solve
65
+ await new Promise(r => setTimeout(r, 5000));
66
+
67
+ // Check if we're on the page (not blocked)
68
+ let result = await page.evaluate(() => {
69
+ // If we can see the turnstile widget or main content, we passed WAF
70
+ return document.querySelector('.cf-turnstile') ||
71
+ document.querySelector('[data-turnstile-widget]') ||
72
+ document.querySelector('h1') ||
73
+ document.body.textContent.includes('Cloudflare') ? true : false;
74
+ }).catch(() => false);
75
+
76
+ assert.strictEqual(result, true, "Cloudflare WAF test failed! Could not access the page.")
71
77
  })
72
78
 
73
79