Skip to content

Commit 7963b2f

Browse files
authored
Update README.md
1 parent 9d33192 commit 7963b2f

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

README.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1+
![npm](https://img.shields.io/npm/v/puppeteer-page-proxy?style=flat-square)
2+
![node-current](https://img.shields.io/node/v/puppeteer?style=flat-square)
3+
![npm](https://img.shields.io/npm/dt/puppeteer-page-proxy?style=flat-square)
4+
15
# puppeteer-page-proxy <img src="https://i.ibb.co/kQrN9QJ/puppeteer-page-proxy-logo.png" align="right" width="150" height="150">
26
Additional Node.js module to use with **[puppeteer](https://www.npmjs.com/package/puppeteer)** for setting proxies per page basis.
37

4-
Forwards intercepted requests from the browser to Node.js where it handles the request then returns the response to the browser, changing the proxy as a result.
8+
Forwards intercepted requests from the browser to Node.js where it redoes the requests through a proxy and then returns the response to the browser.
59

610
## Features
711

@@ -15,16 +19,16 @@ Forwards intercepted requests from the browser to Node.js where it handles the r
1519
npm i puppeteer-page-proxy
1620
```
1721
## API
18-
#### PageProxy(pageOrReq, proxy)
22+
#### useProxy(pageOrReq, proxy)
1923

2024
- `pageOrReq` <[object](https://developer.mozilla.org/en-US/docs/Glossary/Object)> 'Page' or 'Request' object to set a proxy for.
2125
- `proxy` <[string](https://developer.mozilla.org/en-US/docs/Glossary/String)|[object](https://developer.mozilla.org/en-US/docs/Glossary/Object)> Proxy to use in the current page.
2226
* Begins with a protocol (e.g. http://, https://, socks://)
2327
* In the case of [proxy per request](https://github.com/Cuadrix/puppeteer-page-proxy#proxy-per-request), this can be an object with optional properties for overriding requests:\
2428
`url`, `method`, `postData`, `headers`\
25-
See [httpRequest.continue](https://github.com/puppeteer/puppeteer/blob/main/docs/api.md#httprequestcontinueoverrides) for more info about the above properties.
29+
See [ContinueRequestOverrides](https://pptr.dev/api/puppeteer.continuerequestoverrides) for more info about the above properties.
2630

27-
#### PageProxy.lookup(page[, lookupService, isJSON, timeout])
31+
#### useProxy.lookup(page[, lookupService, isJSON, timeout])
2832

2933
- `page` <[object](https://developer.mozilla.org/en-US/docs/Glossary/Object)> 'Page' object to execute the request on.
3034
- `lookupService` <[string](https://developer.mozilla.org/en-US/docs/Glossary/String)> External lookup service to request data from.
@@ -59,9 +63,9 @@ page.on('request', async request => {
5963
await useProxy(request, 'https://127.0.0.1:443');
6064
});
6165
```
62-
The request object itself is passed as the first argument. The proxy can now be changed every request.
66+
The request object itself is passed as the first argument. The individual request will be tunneled through the specified proxy.
6367

64-
Using it along with other interception methods:
68+
Using it together with other interception methods:
6569
```js
6670
await page.setRequestInterception(true);
6771
page.on('request', async request => {
@@ -89,7 +93,7 @@ page.on('request', async request => {
8993
});
9094
```
9195

92-
**NOTE:** It is necessary to set [page.setRequestInterception](https://github.com/puppeteer/puppeteer/blob/main/docs/api.md#pagesetrequestinterceptionvalue) to true when setting proxies per request, otherwise the function will fail.
96+
**NOTE:** It's necessary to set [Page.setRequestInterception()](https://pptr.dev/api/puppeteer.page.setrequestinterception) to true when setting proxies per request, otherwise the function will fail.
9397

9498
#### Authenticating:
9599
```js
@@ -121,7 +125,7 @@ It takes over the task of requesting content **from** the browser to do it inter
121125

122126
#### Why am I getting _"Request is already handled!"_?
123127

124-
This happens when there is an attempt to handle the same request more than once. An intercepted request is handled by either [httpRequest.abort](https://github.com/puppeteer/puppeteer/blob/main/docs/api.md#httprequestaborterrorcode), [httpRequest.continue](https://github.com/puppeteer/puppeteer/blob/main/docs/api.md#httprequestcontinueoverrides) or [httpRequest.respond](https://github.com/puppeteer/puppeteer/blob/main/docs/api.md#httprequestrespondresponse) methods. Each of these methods 'send' the request to its destination. A request that has already reached its destination cannot be intercepted or handled.
128+
This happens when there is an attempt to handle the same request more than once. An intercepted request is handled by either [HTTPRequest.abort()](https://pptr.dev/api/puppeteer.httprequest.abort), [HTTPRequest.continue()](https://pptr.dev/api/puppeteer.httprequest.continue) or [HTTPRequest.respond()](https://pptr.dev/api/puppeteer.httprequest.respond) methods. Each of these methods 'send' the request to its destination. A request that has already reached its destination cannot be intercepted or handled.
125129

126130

127131
#### Why does the browser show _"Your connection to this site is not secure"_?
@@ -141,7 +145,7 @@ connection: TLSSocket {
141145
encrypted: true,
142146
}
143147
```
144-
You can think of the warning as a false positive.
148+
The warning can be thought of as a false positive.
145149

146150
## Dependencies
147151
- [Got](https://github.com/sindresorhus/got)

0 commit comments

Comments
 (0)