undetected-puppeteer-core 24.34.0

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 ADDED
@@ -0,0 +1,114 @@
1
+ # undetected-puppeteer-core
2
+
3
+ A drop-in replacement for [puppeteer-core](https://www.npmjs.com/package/puppeteer-core) with [rebrowser-patches](https://github.com/rebrowser/rebrowser-patches) automatically applied.
4
+
5
+ This package makes puppeteer-core less detectable by anti-bot systems by patching known detection vectors.
6
+
7
+ ## Installation
8
+
9
+ Simply replace `puppeteer-core` with `undetected-puppeteer-core` in your `package.json`:
10
+
11
+ ```json
12
+ {
13
+ "dependencies": {
14
+ "puppeteer-core": "npm:undetected-puppeteer-core@^24.34.0"
15
+ }
16
+ }
17
+ ```
18
+
19
+ Then run:
20
+
21
+ ```bash
22
+ npm install
23
+ ```
24
+
25
+ **That's it!** No code changes required. Your existing imports will continue to work:
26
+
27
+ ```javascript
28
+ const puppeteer = require('puppeteer-core');
29
+ // or
30
+ import puppeteer from 'puppeteer-core';
31
+ ```
32
+
33
+ The rebrowser-patches are automatically applied during the postinstall phase.
34
+
35
+ ## Versioning
36
+
37
+ This package follows the same version numbers as `puppeteer-core`. When a new version of puppeteer-core is released, we publish a matching version with the patches applied.
38
+
39
+ | puppeteer-core | undetected-puppeteer-core |
40
+ |----------------|---------------------------|
41
+ | 24.34.0 | 24.34.0 |
42
+ | ... | ... |
43
+
44
+ ## How It Works
45
+
46
+ 1. You install this package using npm's package aliasing feature
47
+ 2. npm resolves `puppeteer-core` to `undetected-puppeteer-core`
48
+ 3. During installation, `puppeteer-core` is installed as a dependency
49
+ 4. The postinstall script applies `rebrowser-patches` automatically
50
+ 5. Your code uses `require('puppeteer-core')` which loads our patched version
51
+
52
+ ## What Gets Patched
53
+
54
+ The rebrowser-patches project patches various detection vectors in puppeteer-core. For the full list of patches, see the [rebrowser-patches documentation](https://github.com/rebrowser/rebrowser-patches).
55
+
56
+ ## Requirements
57
+
58
+ - Node.js >= 18.0.0
59
+ - A Chrome/Chromium executable (puppeteer-core does not download Chrome automatically)
60
+
61
+ ## TypeScript Support
62
+
63
+ Full TypeScript support is included. All types from puppeteer-core are available:
64
+
65
+ ```typescript
66
+ import puppeteer, { Browser, Page } from 'puppeteer-core';
67
+
68
+ async function main(): Promise<void> {
69
+ const browser: Browser = await puppeteer.launch({
70
+ executablePath: '/path/to/chrome',
71
+ });
72
+ const page: Page = await browser.newPage();
73
+ // ...
74
+ }
75
+ ```
76
+
77
+ ## Example
78
+
79
+ ```javascript
80
+ const puppeteer = require('puppeteer-core');
81
+
82
+ (async () => {
83
+ const browser = await puppeteer.launch({
84
+ executablePath: '/path/to/chrome',
85
+ headless: false,
86
+ });
87
+
88
+ const page = await browser.newPage();
89
+ await page.goto('https://example.com');
90
+
91
+ // Your automation code here...
92
+
93
+ await browser.close();
94
+ })();
95
+ ```
96
+
97
+ ## Troubleshooting
98
+
99
+ ### Patches failed to apply
100
+
101
+ If you see a warning that patches failed to apply during installation, you can try running them manually:
102
+
103
+ ```bash
104
+ npx rebrowser-patches@latest patch --packagePath ./node_modules/undetected-puppeteer-core/node_modules/puppeteer-core
105
+ ```
106
+
107
+ ## License
108
+
109
+ MIT
110
+
111
+ ## Credits
112
+
113
+ - [puppeteer-core](https://github.com/puppeteer/puppeteer) - The original puppeteer library
114
+ - [rebrowser-patches](https://github.com/rebrowser/rebrowser-patches) - The patches that make puppeteer less detectable
package/index.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ /**
2
+ * TypeScript declarations for undetected-puppeteer-core
3
+ *
4
+ * This package re-exports all types from puppeteer-core.
5
+ * The API is identical to puppeteer-core.
6
+ */
7
+
8
+ export * from 'puppeteer-core';
9
+ export { default } from 'puppeteer-core';
package/index.js ADDED
@@ -0,0 +1,19 @@
1
+ /**
2
+ * undetected-puppeteer-core
3
+ *
4
+ * A proxy package for puppeteer-core with rebrowser-patches applied.
5
+ * This package re-exports everything from puppeteer-core, but with
6
+ * patches applied during installation to make it less detectable
7
+ * by anti-bot systems.
8
+ *
9
+ * Usage is identical to puppeteer-core:
10
+ *
11
+ * const puppeteer = require('undetected-puppeteer-core');
12
+ * // or
13
+ * import puppeteer from 'undetected-puppeteer-core';
14
+ *
15
+ * const browser = await puppeteer.launch({ executablePath: '/path/to/chrome' });
16
+ */
17
+
18
+ // Re-export everything from puppeteer-core
19
+ module.exports = require('puppeteer-core');
package/index.mjs ADDED
@@ -0,0 +1,11 @@
1
+ /**
2
+ * undetected-puppeteer-core (ESM)
3
+ *
4
+ * A proxy package for puppeteer-core with rebrowser-patches applied.
5
+ * This package re-exports everything from puppeteer-core, but with
6
+ * patches applied during installation to make it less detectable
7
+ * by anti-bot systems.
8
+ */
9
+
10
+ export * from 'puppeteer-core';
11
+ export { default } from 'puppeteer-core';
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "undetected-puppeteer-core",
3
+ "version": "24.34.0",
4
+ "description": "Drop-in replacement for puppeteer-core with rebrowser-patches applied for stealth browsing",
5
+ "main": "index.js",
6
+ "module": "index.mjs",
7
+ "types": "index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": {
11
+ "types": "./index.d.ts",
12
+ "default": "./index.mjs"
13
+ },
14
+ "require": {
15
+ "types": "./index.d.ts",
16
+ "default": "./index.js"
17
+ }
18
+ },
19
+ "./package.json": "./package.json"
20
+ },
21
+ "scripts": {
22
+ "postinstall": "node postinstall.js"
23
+ },
24
+ "keywords": [
25
+ "puppeteer",
26
+ "puppeteer-core",
27
+ "stealth",
28
+ "undetected",
29
+ "rebrowser",
30
+ "patches",
31
+ "automation",
32
+ "headless",
33
+ "chrome",
34
+ "chromium"
35
+ ],
36
+ "author": "",
37
+ "license": "MIT",
38
+ "dependencies": {
39
+ "puppeteer-core": "24.34.0"
40
+ },
41
+ "repository": {
42
+ "type": "git",
43
+ "url": "https://github.com/Spaaark-io/undetected-puppeteer-core.git"
44
+ },
45
+ "engines": {
46
+ "node": ">=18.0.0"
47
+ }
48
+ }
package/postinstall.js ADDED
@@ -0,0 +1,86 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { execSync } = require('child_process');
4
+ const path = require('path');
5
+ const fs = require('fs');
6
+
7
+ /**
8
+ * Postinstall script that applies rebrowser-patches to puppeteer-core
9
+ * This makes puppeteer-core less detectable by anti-bot systems
10
+ */
11
+
12
+ function findPuppeteerCorePath() {
13
+ // Try to find puppeteer-core in various possible locations
14
+ const possiblePaths = [
15
+ // When this package is installed as a dependency
16
+ path.resolve(__dirname, 'node_modules', 'puppeteer-core'),
17
+ // When installed in a monorepo or hoisted
18
+ path.resolve(__dirname, '..', 'puppeteer-core'),
19
+ // Fallback: try to resolve from require
20
+ ];
21
+
22
+ for (const p of possiblePaths) {
23
+ if (fs.existsSync(p) && fs.existsSync(path.join(p, 'package.json'))) {
24
+ return p;
25
+ }
26
+ }
27
+
28
+ // Try using require.resolve as last resort
29
+ try {
30
+ const puppeteerMain = require.resolve('puppeteer-core');
31
+ // Go up from the main file to the package root
32
+ let dir = path.dirname(puppeteerMain);
33
+ while (dir !== path.dirname(dir)) {
34
+ if (fs.existsSync(path.join(dir, 'package.json'))) {
35
+ const pkg = JSON.parse(fs.readFileSync(path.join(dir, 'package.json'), 'utf8'));
36
+ if (pkg.name === 'puppeteer-core') {
37
+ return dir;
38
+ }
39
+ }
40
+ dir = path.dirname(dir);
41
+ }
42
+ } catch (e) {
43
+ // Ignore resolution errors
44
+ }
45
+
46
+ return null;
47
+ }
48
+
49
+ function applyPatches() {
50
+ console.log('[undetected-puppeteer-core] Applying rebrowser-patches...');
51
+
52
+ const puppeteerCorePath = findPuppeteerCorePath();
53
+
54
+ if (!puppeteerCorePath) {
55
+ console.error('[undetected-puppeteer-core] Could not find puppeteer-core package path');
56
+ console.error('[undetected-puppeteer-core] Please ensure puppeteer-core is installed');
57
+ process.exit(1);
58
+ }
59
+
60
+ console.log(`[undetected-puppeteer-core] Found puppeteer-core at: ${puppeteerCorePath}`);
61
+
62
+ try {
63
+ // Run rebrowser-patches to patch puppeteer-core
64
+ const command = `npx rebrowser-patches@latest patch --packagePath "${puppeteerCorePath}"`;
65
+ console.log(`[undetected-puppeteer-core] Running: ${command}`);
66
+
67
+ execSync(command, {
68
+ stdio: 'inherit',
69
+ cwd: __dirname
70
+ });
71
+
72
+ console.log('[undetected-puppeteer-core] Patches applied successfully!');
73
+ } catch (error) {
74
+ console.error('[undetected-puppeteer-core] Failed to apply patches:', error.message);
75
+ // Don't exit with error code to not break installation
76
+ // The package will still work, just without patches
77
+ console.warn('[undetected-puppeteer-core] Continuing without patches...');
78
+ }
79
+ }
80
+
81
+ // Only run if this script is executed directly (not required as a module)
82
+ if (require.main === module) {
83
+ applyPatches();
84
+ }
85
+
86
+ module.exports = { applyPatches, findPuppeteerCorePath };