pupeteerextra 0.0.1-security → 3.3.6

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of pupeteerextra might be problematic. Click here for more details.

package/readme.md ADDED
@@ -0,0 +1,609 @@
1
+ # puppeteer-extra [![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/berstend/puppeteer-extra/test.yml?branch=master&event=push)](https://github.com/berstend/puppeteer-extra/actions) [![Discord](https://img.shields.io/discord/737009125862408274)](https://extra.community) [![npm](https://img.shields.io/npm/v/puppeteer-extra.svg)](https://www.npmjs.com/package/puppeteer-extra) [![npm](https://img.shields.io/npm/dt/puppeteer-extra.svg)](https://www.npmjs.com/package/puppeteer-extra) [![npm](https://img.shields.io/npm/l/puppeteer-extra.svg)](https://www.npmjs.com/package/puppeteer-extra)
2
+
3
+ > A light-weight wrapper around [`puppeteer`](https://github.com/GoogleChrome/puppeteer) and [friends](#more-examples) to enable cool [plugins](#plugins) through a clean interface.
4
+
5
+ <a href="https://github.com/berstend/puppeteer-extra"><img src="https://i.imgur.com/qtlnoQL.png" width="279px" height="187px" align="right" /></a>
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ yarn add puppeteer puppeteer-extra
11
+ # - or -
12
+ npm install puppeteer puppeteer-extra
13
+
14
+ # puppeteer-extra works with any puppeteer version:
15
+ yarn add puppeteer@2.0.0 puppeteer-extra
16
+ ```
17
+
18
+ ## Quickstart
19
+
20
+ ```js
21
+ // puppeteer-extra is a drop-in replacement for puppeteer,
22
+ // it augments the installed puppeteer with plugin functionality.
23
+ // Any number of plugins can be added through `puppeteer.use()`
24
+ const puppeteer = require('puppeteer-extra')
25
+
26
+ // Add stealth plugin and use defaults (all tricks to hide puppeteer usage)
27
+ const StealthPlugin = require('puppeteer-extra-plugin-stealth')
28
+ puppeteer.use(StealthPlugin())
29
+
30
+ // Add adblocker plugin to block all ads and trackers (saves bandwidth)
31
+ const AdblockerPlugin = require('puppeteer-extra-plugin-adblocker')
32
+ puppeteer.use(AdblockerPlugin({ blockTrackers: true }))
33
+
34
+ // That's it, the rest is puppeteer usage as normal 😊
35
+ puppeteer.launch({ headless: true }).then(async browser => {
36
+ const page = await browser.newPage()
37
+ await page.setViewport({ width: 800, height: 600 })
38
+
39
+ console.log(`Testing adblocker plugin..`)
40
+ await page.goto('https://www.vanityfair.com')
41
+ await page.waitForTimeout(1000)
42
+ await page.screenshot({ path: 'adblocker.png', fullPage: true })
43
+
44
+ console.log(`Testing the stealth plugin..`)
45
+ await page.goto('https://bot.sannysoft.com')
46
+ await page.waitForTimeout(5000)
47
+ await page.screenshot({ path: 'stealth.png', fullPage: true })
48
+
49
+ console.log(`All done, check the screenshots. ✨`)
50
+ await browser.close()
51
+ })
52
+ ```
53
+
54
+ The above example uses the [`stealth`](/packages/puppeteer-extra-plugin-stealth) and [`adblocker`](/packages/puppeteer-extra-plugin-adblocker) plugin, which need to be installed as well:
55
+
56
+ ```bash
57
+ yarn add puppeteer-extra-plugin-stealth puppeteer-extra-plugin-adblocker
58
+ # - or -
59
+ npm install puppeteer-extra-plugin-stealth puppeteer-extra-plugin-adblocker
60
+ ```
61
+
62
+ If you'd like to see debug output just run your script like so:
63
+
64
+ ```bash
65
+ DEBUG=puppeteer-extra,puppeteer-extra-plugin:* node myscript.js
66
+ ```
67
+
68
+ ### More examples
69
+
70
+ <details>
71
+ <summary><strong>TypeScript usage</strong></summary><br/>
72
+
73
+ > `puppeteer-extra` and most plugins are written in TS,
74
+ > so you get perfect type support out of the box. :)
75
+
76
+ ```ts
77
+ import puppeteer from 'puppeteer-extra'
78
+
79
+ import AdblockerPlugin from 'puppeteer-extra-plugin-adblocker'
80
+ import StealthPlugin from 'puppeteer-extra-plugin-stealth'
81
+
82
+ puppeteer.use(AdblockerPlugin()).use(StealthPlugin())
83
+
84
+ puppeteer
85
+ .launch({ headless: false, defaultViewport: null })
86
+ .then(async browser => {
87
+ const page = await browser.newPage()
88
+ await page.goto('https://bot.sannysoft.com')
89
+ await page.waitForTimeout(5000)
90
+ await page.screenshot({ path: 'stealth.png', fullPage: true })
91
+ await browser.close()
92
+ })
93
+ ```
94
+
95
+ > Please check this [wiki](https://github.com/berstend/puppeteer-extra/wiki/TypeScript-usage) entry in case you have TypeScript related import issues.
96
+
97
+ ![typings](https://i.imgur.com/bNtuTOt.png 'Typings')
98
+
99
+ </details>
100
+
101
+ <details>
102
+ <summary><strong>Playwright usage</strong></summary><br/>
103
+
104
+ [`playright-extra`](/packages/playwright-extra) with plugin support is available as well.
105
+
106
+ </details>
107
+
108
+ <details>
109
+ <summary><strong>Multiple puppeteers with different plugins</strong></summary><br/>
110
+
111
+ ```js
112
+ const vanillaPuppeteer = require('puppeteer')
113
+
114
+ const { addExtra } = require('puppeteer-extra')
115
+ const AnonymizeUA = require('puppeteer-extra-plugin-anonymize-ua')
116
+
117
+ async function main() {
118
+ const pptr1 = addExtra(vanillaPuppeteer)
119
+ pptr1.use(
120
+ AnonymizeUA({
121
+ customFn: ua => 'Hello1/' + ua.replace('Chrome', 'Beer')
122
+ })
123
+ )
124
+
125
+ const pptr2 = addExtra(vanillaPuppeteer)
126
+ pptr2.use(
127
+ AnonymizeUA({
128
+ customFn: ua => 'Hello2/' + ua.replace('Chrome', 'Beer')
129
+ })
130
+ )
131
+
132
+ await checkUserAgent(pptr1)
133
+ await checkUserAgent(pptr2)
134
+ }
135
+
136
+ main()
137
+
138
+ async function checkUserAgent(pptr) {
139
+ const browser = await pptr.launch({ headless: true })
140
+ const page = await browser.newPage()
141
+ await page.goto('https://httpbin.org/headers', {
142
+ waitUntil: 'domcontentloaded'
143
+ })
144
+ const content = await page.content()
145
+ console.log(content)
146
+ await browser.close()
147
+ }
148
+ ```
149
+
150
+ </details>
151
+
152
+ <details>
153
+ <summary><strong>Using with <code>puppeteer-cluster</code></strong></summary><br/>
154
+
155
+ > [puppeteer-cluster](https://github.com/thomasdondorf/puppeteer-cluster) allows you to create a cluster of puppeteer workers and plays well together with `puppeteer-extra`.
156
+
157
+ ```js
158
+ const { Cluster } = require('puppeteer-cluster')
159
+ const vanillaPuppeteer = require('puppeteer')
160
+
161
+ const { addExtra } = require('puppeteer-extra')
162
+ const Stealth = require('puppeteer-extra-plugin-stealth')
163
+ const Recaptcha = require('puppeteer-extra-plugin-recaptcha')
164
+
165
+ async function main() {
166
+ // Create a custom puppeteer-extra instance using `addExtra`,
167
+ // so we could create additional ones with different plugin config.
168
+ const puppeteer = addExtra(vanillaPuppeteer)
169
+ puppeteer.use(Stealth())
170
+ puppeteer.use(Recaptcha())
171
+
172
+ // Launch cluster with puppeteer-extra
173
+ const cluster = await Cluster.launch({
174
+ puppeteer,
175
+ maxConcurrency: 2,
176
+ concurrency: Cluster.CONCURRENCY_CONTEXT
177
+ })
178
+
179
+ // Define task handler
180
+ await cluster.task(async ({ page, data: url }) => {
181
+ await page.goto(url)
182
+
183
+ const { hostname } = new URL(url)
184
+ const { captchas } = await page.findRecaptchas()
185
+ console.log(`Found ${captchas.length} captcha on ${hostname}`)
186
+
187
+ await page.screenshot({ path: `${hostname}.png`, fullPage: true })
188
+ })
189
+
190
+ // Queue any number of tasks
191
+ cluster.queue('https://bot.sannysoft.com')
192
+ cluster.queue('https://www.google.com/recaptcha/api2/demo')
193
+ cluster.queue('http://www.wikipedia.org/')
194
+
195
+ await cluster.idle()
196
+ await cluster.close()
197
+ console.log(`All done, check the screenshots. ✨`)
198
+ }
199
+
200
+ // Let's go
201
+ main().catch(console.warn)
202
+ ```
203
+
204
+ For using with TypeScript, just change your imports to:
205
+
206
+ ```ts
207
+ import { Cluster } from 'puppeteer-cluster'
208
+ import vanillaPuppeteer from 'puppeteer'
209
+
210
+ import { addExtra } from 'puppeteer-extra'
211
+ import Stealth from 'puppeteer-extra-plugin-stealth'
212
+ import Recaptcha from 'puppeteer-extra-plugin-recaptcha'
213
+ ```
214
+
215
+ </details>
216
+
217
+ <details>
218
+ <summary><strong>Using with <code>chrome-aws-lambda</code></strong></summary><br/>
219
+
220
+ > If you plan to use [chrome-aws-lambda](https://github.com/alixaxel/chrome-aws-lambda) with the [`stealth`](/packages/puppeteer-extra-plugin-stealth) plugin, you'll need to modify the default args to remove the
221
+ > `--disable-notifications` flag to pass all the tests.
222
+
223
+ ```js
224
+ const chromium = require('chrome-aws-lambda')
225
+ const { addExtra } = require('puppeteer-extra')
226
+ const puppeteerExtra = addExtra(chromium.puppeteer)
227
+
228
+ const launch = async () => {
229
+ puppeteerExtra
230
+ .launch({
231
+ args: chromium.args,
232
+ defaultViewport: chromium.defaultViewport,
233
+ executablePath: await chromium.executablePath,
234
+ headless: chromium.headless
235
+ })
236
+ .then(async browser => {
237
+ const page = await browser.newPage()
238
+ await page.goto('https://www.spacejam.com/archive/spacejam/movie/jam.htm')
239
+ await page.waitForTimeout(10 * 1000)
240
+ await browser.close()
241
+ })
242
+ }
243
+
244
+ launch() // Launch Browser
245
+ ```
246
+
247
+ </details>
248
+
249
+ <details>
250
+ <summary><strong>Using with <code>Kikobeats/browserless</code></strong></summary><br/>
251
+
252
+ > [Kikobeats/browserless](https://github.com/Kikobeats/browserless) is a puppeteer-like Node.js library for interacting with Headless production scenarios.
253
+
254
+ ```js
255
+ const puppeteer = require('puppeteer-extra')
256
+ const StealthPlugin = require('puppeteer-extra-plugin-stealth')
257
+ puppeteer.use(StealthPlugin())
258
+
259
+ const browserless = require('browserless')({ puppeteer })
260
+
261
+ const saveBufferToFile = (buffer, fileName) => {
262
+ const wstream = require('fs').createWriteStream(fileName)
263
+ wstream.write(buffer)
264
+ wstream.end()
265
+ }
266
+
267
+ browserless
268
+ .screenshot('https://bot.sannysoft.com', { device: 'iPhone 6' })
269
+ .then(buffer => {
270
+ const fileName = 'screenshot.png'
271
+ saveBufferToFile(buffer, fileName)
272
+ console.log(`your screenshot is here: `, fileName)
273
+ })
274
+ ```
275
+
276
+ </details>
277
+
278
+ ---
279
+
280
+ ## Plugins
281
+
282
+ #### 🔥 [`puppeteer-extra-plugin-stealth`](/packages/puppeteer-extra-plugin-stealth)
283
+
284
+ - Applies various evasion techniques to make detection of puppeteer harder.
285
+
286
+ #### 🏴 [`puppeteer-extra-plugin-recaptcha`](/packages/puppeteer-extra-plugin-recaptcha)
287
+
288
+ - Solves reCAPTCHAs and hCaptchas automatically, using a single line of code: `page.solveRecaptchas()`.
289
+
290
+ #### [`puppeteer-extra-plugin-adblocker`](/packages/puppeteer-extra-plugin-adblocker)
291
+
292
+ - Very fast & efficient blocker for ads and trackers. Reduces bandwidth & load times.
293
+
294
+ #### [`puppeteer-extra-plugin-devtools`](/packages/puppeteer-extra-plugin-devtools)
295
+
296
+ - Makes puppeteer browser debugging possible from anywhere.
297
+ - Creates a secure tunnel to make the devtools frontend (**incl. screencasting**) accessible from the public internet
298
+
299
+ #### [`puppeteer-extra-plugin-repl`](/packages/puppeteer-extra-plugin-repl)
300
+
301
+ - Makes quick puppeteer debugging and exploration fun with an interactive REPL.
302
+
303
+ #### [`puppeteer-extra-plugin-block-resources`](/packages/puppeteer-extra-plugin-block-resources)
304
+
305
+ - Blocks resources (images, media, css, etc.) in puppeteer.
306
+ - Supports all resource types, blocking can be toggled dynamically.
307
+
308
+ #### [`puppeteer-extra-plugin-flash`](/packages/puppeteer-extra-plugin-flash)
309
+
310
+ - Allows flash content to run on all sites without user interaction.
311
+
312
+ #### [`puppeteer-extra-plugin-anonymize-ua`](/packages/puppeteer-extra-plugin-anonymize-ua)
313
+
314
+ - Anonymizes the user-agent on all pages.
315
+ - Supports dynamic replacing, so the browser version stays intact and recent.
316
+
317
+ #### [`puppeteer-extra-plugin-user-preferences`](/packages/puppeteer-extra-plugin-user-preferences)
318
+
319
+ - Allows setting custom Chrome/Chromium user preferences.
320
+ - Has itself a plugin interface which is used by e.g. [`puppeteer-extra-plugin-font-size`](/packages/puppeteer-extra-plugin-font-size).
321
+
322
+ > Check out the [packages folder](/packages/) for more plugins.
323
+
324
+ ### Community Plugins
325
+
326
+ _These plugins have been generously contributed by members of the community._
327
+ _Please note that they're hosted outside the main project and not under our control or supervision._
328
+
329
+ #### [`puppeteer-extra-plugin-minmax`](https://github.com/Stillerman/puppeteer-extra-minmax)
330
+
331
+ - Minimize and maximize puppeteer in real time.
332
+ - Great for manually solving captchas.
333
+
334
+ #### [`puppeteer-extra-plugin-portal`](https://github.com/claabs/puppeteer-extra-plugin-portal)
335
+
336
+ - Use the Chromium screencast API to remotely view and interact with puppeteer sessions.
337
+ - Great for remotely intervening when an automated task gets stuck, like captchas.
338
+
339
+ > Please check the `Contributing` section below if you're interested in creating a plugin as well.
340
+
341
+ ---
342
+
343
+ ## Contributors
344
+
345
+ <a href="https://github.com/berstend/puppeteer-extra/graphs/contributors">
346
+ <img src="https://contributors-img.firebaseapp.com/image?repo=berstend/puppeteer-extra" />
347
+ </a>
348
+
349
+ ## Further info
350
+
351
+ <details>
352
+ <summary><strong>Contributing</strong></summary><br/>
353
+
354
+ PRs and new plugins are welcome! 🎉 The plugin API for `puppeteer-extra` is clean and fun to use. Have a look the [PuppeteerExtraPlugin](/packages/puppeteer-extra-plugin) base class documentation to get going and check out the [existing plugins](./packages/) (minimal example is the [anonymize-ua](/packages/puppeteer-extra-plugin-anonymize-ua/index.js) plugin) for reference.
355
+
356
+ We use a [monorepo](/) powered by [Lerna](https://github.com/lerna/lerna#--use-workspaces) (and yarn workspaces), [ava](https://github.com/avajs/ava) for testing, TypeScript for the core, the [standard](https://standardjs.com/) style for linting and [JSDoc](http://usejsdoc.org/about-getting-started.html) heavily to auto-generate markdown [documentation](https://github.com/documentationjs/documentation) based on code. :-)
357
+
358
+ </details>
359
+
360
+ <details>
361
+ <summary><strong>Kudos</strong></summary><br/>
362
+
363
+ - Thanks to [skyiea](https://github.com/skyiea) for [this PR](https://github.com/GoogleChrome/puppeteer/pull/1806) that started the project idea.
364
+ - Thanks to [transitive-bullshit](https://github.com/transitive-bullshit) for [suggesting](https://github.com/berstend/puppeteer-extra/issues/2) a modular plugin design, which was fun to implement.
365
+
366
+ </details>
367
+
368
+ <details>
369
+ <summary><strong>Compatibility</strong></summary><br/>
370
+
371
+ `puppeteer-extra` and all plugins are [tested continously](https://github.com/berstend/puppeteer-extra/actions) in a matrix of current (stable & LTS) NodeJS and puppeteer versions.
372
+ We never broke compatibility and still support puppeteer down to very early versions from 2018.
373
+
374
+ A few plugins won't work in headless mode (it's noted if that's the case) due to Chrome limitations (e.g. the [`user-preferences`](/packages/puppeteer-extra-plugin-user-preferences) plugin), look into `xvfb-run` if you still require a headless experience in these circumstances.
375
+
376
+ </details>
377
+
378
+ ## Changelog
379
+
380
+ <details>
381
+ <summary><code>2.1.6 ➠ 3.1.1</code></summary>
382
+
383
+ ### `2.1.6` ➠ `3.1.1`
384
+
385
+ Big refactor, the core is now **written in TypeScript** 🎉
386
+ That means out of the box type safety for fellow TS users and nice auto-completion in VSCode for JS users. Also:
387
+
388
+ - A new [`addExtra`](#addextrapuppeteer) export, to **patch any puppeteer compatible library with plugin functionality** (`chrome-aws-lambda`, etc). This also allows for multiple puppeteer instances with different plugins.
389
+
390
+ The API is backwards compatible, I bumped the major version just in case I missed something. Please report any issues you might find with the new release. :)
391
+
392
+ </details>
393
+
394
+ ---
395
+
396
+ ## API
397
+
398
+ <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
399
+
400
+ #### Table of Contents
401
+
402
+ - [class: PuppeteerExtra](#class-puppeteerextra)
403
+ - [.use(plugin)](#useplugin)
404
+ - [.launch(options?)](#launchoptions)
405
+ - [.connect(options?)](#connectoptions)
406
+ - [.defaultArgs(options?)](#defaultargsoptions)
407
+ - [.executablePath()](#executablepath)
408
+ - [.createBrowserFetcher(options?)](#createbrowserfetcheroptions)
409
+ - [.plugins](#plugins)
410
+ - [.getPluginData(name?)](#getplugindataname)
411
+ - [defaultExport()](#defaultexport)
412
+ - [addExtra(puppeteer)](#addextrapuppeteer)
413
+
414
+ ### class: [PuppeteerExtra](https://github.com/berstend/puppeteer-extra/blob/dc8b90260a927c0c66c4585c5a56092ea9c35049/packages/puppeteer-extra/src/index.ts#L67-L474)
415
+
416
+ Modular plugin framework to teach `puppeteer` new tricks.
417
+
418
+ This module acts as a drop-in replacement for `puppeteer`.
419
+
420
+ Allows PuppeteerExtraPlugin's to register themselves and
421
+ to extend puppeteer with additional functionality.
422
+
423
+ Example:
424
+
425
+ ```javascript
426
+ const puppeteer = require('puppeteer-extra')
427
+ puppeteer.use(require('puppeteer-extra-plugin-anonymize-ua')())
428
+ puppeteer.use(
429
+ require('puppeteer-extra-plugin-font-size')({ defaultFontSize: 18 })
430
+ )
431
+ ;(async () => {
432
+ const browser = await puppeteer.launch({ headless: false })
433
+ const page = await browser.newPage()
434
+ await page.goto('http://example.com', { waitUntil: 'domcontentloaded' })
435
+ await browser.close()
436
+ })()
437
+ ```
438
+
439
+ ---
440
+
441
+ #### .[use(plugin)](https://github.com/berstend/puppeteer-extra/blob/dc8b90260a927c0c66c4585c5a56092ea9c35049/packages/puppeteer-extra/src/index.ts#L85-L107)
442
+
443
+ - `plugin` **PuppeteerExtraPlugin**
444
+
445
+ Returns: **this** The same `PuppeteerExtra` instance (for optional chaining)
446
+
447
+ The **main interface** to register `puppeteer-extra` plugins.
448
+
449
+ Example:
450
+
451
+ ```javascript
452
+ puppeteer.use(plugin1).use(plugin2)
453
+ ```
454
+
455
+ - **See: [PuppeteerExtraPlugin]**
456
+
457
+ ---
458
+
459
+ #### .[launch(options?)](https://github.com/berstend/puppeteer-extra/blob/dc8b90260a927c0c66c4585c5a56092ea9c35049/packages/puppeteer-extra/src/index.ts#L153-L177)
460
+
461
+ - `options` **Puppeteer.LaunchOptions?** See [puppeteer docs](https://github.com/puppeteer/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions).
462
+
463
+ Returns: **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;Puppeteer.Browser>**
464
+
465
+ The method launches a browser instance with given arguments. The browser will be closed when the parent node.js process is closed.
466
+
467
+ Augments the original `puppeteer.launch` method with plugin lifecycle methods.
468
+
469
+ All registered plugins that have a `beforeLaunch` method will be called
470
+ in sequence to potentially update the `options` Object before launching the browser.
471
+
472
+ Example:
473
+
474
+ ```javascript
475
+ const browser = await puppeteer.launch({
476
+ headless: false,
477
+ defaultViewport: null
478
+ })
479
+ ```
480
+
481
+ ---
482
+
483
+ #### .[connect(options?)](https://github.com/berstend/puppeteer-extra/blob/dc8b90260a927c0c66c4585c5a56092ea9c35049/packages/puppeteer-extra/src/index.ts#L189-L208)
484
+
485
+ - `options` **Puppeteer.ConnectOptions?** See [puppeteer docs](https://github.com/puppeteer/puppeteer/blob/master/docs/api.md#puppeteerconnectoptions).
486
+
487
+ Returns: **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;Puppeteer.Browser>**
488
+
489
+ Attach Puppeteer to an existing Chromium instance.
490
+
491
+ Augments the original `puppeteer.connect` method with plugin lifecycle methods.
492
+
493
+ All registered plugins that have a `beforeConnect` method will be called
494
+ in sequence to potentially update the `options` Object before launching the browser.
495
+
496
+ ---
497
+
498
+ #### .[defaultArgs(options?)](https://github.com/berstend/puppeteer-extra/blob/dc8b90260a927c0c66c4585c5a56092ea9c35049/packages/puppeteer-extra/src/index.ts#L215-L217)
499
+
500
+ - `options` **Puppeteer.ChromeArgOptions?** See [puppeteer docs](https://github.com/puppeteer/puppeteer/blob/master/docs/api.md#puppeteerdefaultargsoptions).
501
+
502
+ Returns: **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>**
503
+
504
+ The default flags that Chromium will be launched with.
505
+
506
+ ---
507
+
508
+ #### .[executablePath()](https://github.com/berstend/puppeteer-extra/blob/dc8b90260a927c0c66c4585c5a56092ea9c35049/packages/puppeteer-extra/src/index.ts#L220-L222)
509
+
510
+ Returns: **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
511
+
512
+ Path where Puppeteer expects to find bundled Chromium.
513
+
514
+ ---
515
+
516
+ #### .[createBrowserFetcher(options?)](https://github.com/berstend/puppeteer-extra/blob/dc8b90260a927c0c66c4585c5a56092ea9c35049/packages/puppeteer-extra/src/index.ts#L229-L233)
517
+
518
+ - `options` **Puppeteer.FetcherOptions?** See [puppeteer docs](https://github.com/puppeteer/puppeteer/blob/master/docs/api.md#puppeteercreatebrowserfetcheroptions).
519
+
520
+ Returns: **Puppeteer.BrowserFetcher**
521
+
522
+ This methods attaches Puppeteer to an existing Chromium instance.
523
+
524
+ ---
525
+
526
+ #### .[plugins](https://github.com/berstend/puppeteer-extra/blob/dc8b90260a927c0c66c4585c5a56092ea9c35049/packages/puppeteer-extra/src/index.ts#L283-L285)
527
+
528
+ Type: **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;PuppeteerExtraPlugin>**
529
+
530
+ Get a list of all registered plugins.
531
+
532
+ ---
533
+
534
+ #### .[getPluginData(name?)](https://github.com/berstend/puppeteer-extra/blob/dc8b90260a927c0c66c4585c5a56092ea9c35049/packages/puppeteer-extra/src/index.ts#L310-L315)
535
+
536
+ - `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Filter data by optional plugin name
537
+
538
+ Collects the exposed `data` property of all registered plugins.
539
+ Will be reduced/flattened to a single array.
540
+
541
+ Can be accessed by plugins that listed the `dataFromPlugins` requirement.
542
+
543
+ Implemented mainly for plugins that need data from other plugins (e.g. `user-preferences`).
544
+
545
+ - **See: [PuppeteerExtraPlugin]/data**
546
+
547
+ ---
548
+
549
+ ### [defaultExport()](https://github.com/berstend/puppeteer-extra/blob/dc8b90260a927c0c66c4585c5a56092ea9c35049/packages/puppeteer-extra/src/index.ts#L494-L496)
550
+
551
+ Type: **[PuppeteerExtra](#puppeteerextra)**
552
+
553
+ The **default export** will behave exactly the same as the regular puppeteer
554
+ (just with extra plugin functionality) and can be used as a drop-in replacement.
555
+
556
+ Behind the scenes it will try to require either `puppeteer`
557
+ or [`puppeteer-core`](https://github.com/puppeteer/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core)
558
+ from the installed dependencies.
559
+
560
+ Example:
561
+
562
+ ```javascript
563
+ // javascript import
564
+ const puppeteer = require('puppeteer-extra')
565
+
566
+ // typescript/es6 module import
567
+ import puppeteer from 'puppeteer-extra'
568
+
569
+ // Add plugins
570
+ puppeteer.use(...)
571
+ ```
572
+
573
+ ---
574
+
575
+ ### [addExtra(puppeteer)](https://github.com/berstend/puppeteer-extra/blob/dc8b90260a927c0c66c4585c5a56092ea9c35049/packages/puppeteer-extra/src/index.ts#L519-L520)
576
+
577
+ - `puppeteer` **VanillaPuppeteer** Any puppeteer API-compatible puppeteer implementation or version.
578
+
579
+ Returns: **[PuppeteerExtra](#puppeteerextra)** A fresh PuppeteerExtra instance using the provided puppeteer
580
+
581
+ An **alternative way** to use `puppeteer-extra`: Augments the provided puppeteer with extra plugin functionality.
582
+
583
+ This is useful in case you need multiple puppeteer instances with different plugins or to add plugins to a non-standard puppeteer package.
584
+
585
+ Example:
586
+
587
+ ```javascript
588
+ // js import
589
+ const puppeteerVanilla = require('puppeteer')
590
+ const { addExtra } = require('puppeteer-extra')
591
+
592
+ // ts/es6 import
593
+ import puppeteerVanilla from 'puppeteer'
594
+ import { addExtra } from 'puppeteer-extra'
595
+
596
+ // Patch provided puppeteer and add plugins
597
+ const puppeteer = addExtra(puppeteerVanilla)
598
+ puppeteer.use(...)
599
+ ```
600
+
601
+ ---
602
+
603
+ ## License
604
+
605
+ Copyright © 2018 - 2023, [berstend̡̲̫̹̠̖͚͓̔̄̓̐̄͛̀͘](mailto:github@berstend.com?subject=[GitHub]%20PuppeteerExtra). Released under the MIT License.
606
+
607
+ <!-- Markdown footnotes (for links) -->
608
+
609
+ [puppeteerextraplugin]: https://github.com/berstend/puppeteer-extra/tree/master/packages/puppeteer-extra-plugin 'PuppeteerExtraPlugin Documentation'
package/README.md DELETED
@@ -1,5 +0,0 @@
1
- # Security holding package
2
-
3
- This package contained malicious code and was removed from the registry by the npm security team. A placeholder was published to ensure users are not affected in the future.
4
-
5
- Please refer to www.npmjs.com/advisories?search=pupeteerextra for more information.