# zyte-proxy-puppeteer

> A puppeteer enhancement with zyte smart proxy manager services.

Latest version **1.0.2** (published 2021-12-21) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install zyte-proxy-puppeteer
pnpm add zyte-proxy-puppeteer
yarn add zyte-proxy-puppeteer
bun add zyte-proxy-puppeteer
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2021-12-21 |
| First published | 2021-12-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 19.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Shashank Kumar \| realslimshanky |
| Maintainers | geronsv, realslimshanky |
| Keywords | puppeteer, zyte, smart, proxy, manager |

## Links

- npm: https://www.npmjs.com/package/zyte-proxy-puppeteer
- Homepage: https://github.com/zytedata/zyte-proxy-puppeteer
- npm.io page: https://npm.io/package/zyte-proxy-puppeteer

## Dependencies (3)

- [puppeteer](https://npm.io/package/puppeteer.md) ^10.4.0
- [cross-fetch](https://npm.io/package/cross-fetch.md) ^3.1.4
- [@cliqz/adblocker-puppeteer](https://npm.io/package/@cliqz/adblocker-puppeteer.md) ^1.23.0

## Alternatives

- [@snazzah/davey](https://npm.io/package/@snazzah/davey.md) — 1.5M weekly downloads
- [@vendure/testing](https://npm.io/package/@vendure/testing.md) — 8.3K weekly downloads
- [vue-simple-context-menu](https://npm.io/package/vue-simple-context-menu.md) — 6.6K weekly downloads
- [cypress-webpack-preprocessor-v5](https://npm.io/package/cypress-webpack-preprocessor-v5.md) — 2.1K weekly downloads
- [@backstage/plugin-catalog-backend-module-puppetdb](https://npm.io/package/@backstage/plugin-catalog-backend-module-puppetdb.md) — 1.3K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2021-12-21
- 1.0.0 — 2021-12-21

## README

# Zyte Proxy Puppeteer
[![made-with-javascript](https://img.shields.io/badge/Made%20with-JavaScript-1f425f.svg)](https://www.javascript.com)

Use [Puppeteer](https://github.com/puppeteer/puppeteer/) with
[Smart Proxy Manager](https://www.zyte.com/smart-proxy-manager/) easily!

A wrapper over Puppeteer to provide Zyte Smart Proxy Manager specific functionalities.


## QuickStart

1. **Install Zyte Proxy Puppeteer**

```
npm install zyte-proxy-puppeteer
```

2. **Create a file `sample.js` with following content and replace `<SPM_APIKEY>` with your SPM Apikey**

``` javascript
const puppeteer = require('zyte-proxy-puppeteer');

(async () => {
    const browser = await puppeteer.launch({
        spm_apikey: '<SPM_APIKEY>'
    });
    console.log('Before new page');
    const page = await browser.newPage();

    console.log('Opening page ...');
    try {
        await page.goto('https://toscrape.com/', {timeout: 180000});
    } catch(err) {
        console.log(err);
    }

    console.log('Taking a screenshot ...');
    await page.screenshot({path: 'screenshot.png'});
    await browser.close();
})();
```

Make sure that you're able to make `https` requests using Smart Proxy Manager by following this guide [Fetching HTTPS pages with Zyte Smart Proxy Manager](https://docs.zyte.com/smart-proxy-manager/next-steps/fetching-https-pages-with-smart-proxy.html)

3. **Run `sample.js` using Node**

``` bash
node sample.js
```

## API

`ZyteProxyPuppeteer.launch` accepts all the arguments accepted by `Puppeteer.launch` and some
additional arguments defined below:

| Argument | Default Value | Description |
|----------|---------------|-------------|
| `spm_apikey` (required) | `undefined` | Zyte Smart Proxy Manager API key that can be found on your zyte.com account. |
| `spm_host` | `http://proxy.zyte.com:8011` | Zyte Smart Proxy Manager proxy host. |
| `static_bypass` | `true` | When `true` ZyteProxyPuppeteer will skip proxy use for static assets defined by `static_bypass_regex` or pass `false` to use proxy. |
| `static_bypass_regex` | `/.*?\.(?:txt\|css\|eot\|gif\|ico\|jpe?g\|js\|less\|mkv\|mp4\|mpe?g\|png\|ttf\|webm\|webp\|woff2?)$/` | Regex to use filtering URLs for `static_bypass`. |
| `block_ads` | `true` | When `true` ZyteProxyPuppeteer will block ads defined by `block_list` using `@cliqz/adblocker-puppeteer` package. |
| `block_list` | `['https://easylist.to/easylist/easylist.txt', 'https://easylist.to/easylist/easyprivacy.txt']` | Block list to be used by ZyteProxyPuppeteer in order to initiate blocker enginer using `@cliqz/adblocker-puppeteer` and block ads |

---
_Source: https://npm.io/package/zyte-proxy-puppeteer · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
