Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/f9mac/puppeteer-extra-plugin-proxy
A plugin for puppeteer-extra to add proxy support
https://github.com/f9mac/puppeteer-extra-plugin-proxy
puppeteer puppeteer-extra puppeteer-plugins puppeteer-proxy
Last synced: about 1 month ago
JSON representation
A plugin for puppeteer-extra to add proxy support
- Host: GitHub
- URL: https://github.com/f9mac/puppeteer-extra-plugin-proxy
- Owner: f9mac
- License: mit
- Created: 2019-07-22T15:10:10.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-30T18:17:53.000Z (almost 2 years ago)
- Last Synced: 2024-09-30T16:26:23.398Z (about 1 month ago)
- Topics: puppeteer, puppeteer-extra, puppeteer-plugins, puppeteer-proxy
- Language: JavaScript
- Homepage:
- Size: 73.2 KB
- Stars: 17
- Watchers: 0
- Forks: 1
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# puppeteer-extra-plugin-proxy
> A plugin for [puppeteer-extra](https://github.com/berstend/puppeteer-extra) to add proxy support
## Install
```bash
yarn add puppeteer-extra-plugin-proxy
# - or -
npm install puppeteer-extra-plugin-proxy
```If this is your first [puppeteer-extra](https://github.com/berstend/puppeteer-extra) plugin here's everything you need:
```bash
yarn add puppeteer puppeteer-extra puppeteer-extra-plugin-proxy
# - or -
npm install puppeteer puppeteer-extra puppeteer-extra-plugin-proxy
```## Usage
```js
// puppeteer-extra is a drop-in replacement for puppeteer,
// it augments the installed puppeteer with plugin functionality
const puppeteer = require('puppeteer-extra');
// require proxy plugin
const pluginProxy = require('puppeteer-extra-plugin-proxy');
// add proxy plugin without proxy crendentials
puppeteer.use(pluginProxy({
address: '123.123.123.123',
port: 1001
}));
// or you can specify a proxy with crendentials like so
// puppeteer.use(pluginProxy({
// address: '123.123.123.123',
// port: 1001,
// credentials: {
// username: 'user1',
// password: '123456',
// }
// }));// puppeteer usage as normal
puppeteer.launch({ headless: true }).then(async browser => {
const page = await browser.newPage()
await page.setViewport({ width: 800, height: 600 })
// will go through the specified proxy
await page.goto("https://example.com")
await page.waitFor(5000)
await page.screenshot({ path: "testresult.png", fullPage: true })
await browser.close()
})
```For more info [see the tests](./test/test.js).