{"_id":"@doridian/puppeteer-page-proxy","_rev":"3-4b35ad4ce2cf0f260678267aca429a17","name":"@doridian/puppeteer-page-proxy","dist-tags":{"latest":"1.2.11"},"versions":{"1.2.9":{"name":"@doridian/puppeteer-page-proxy","description":"Additional Node.js module to use with 'puppeteer' for setting proxies per page basis.","version":"1.2.9","author":{"name":"Cuadrix","email":"cuadrix12000@gmail.com","url":"https://github.com/Cuadrix"},"homepage":"https://github.com/Cuadrix/puppeteer-page-proxy","main":"./src/index.js","types":"./src/index.d.ts","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/Cuadrix/puppeteer-page-proxy.git"},"keywords":["puppeteer","proxy","page","headless","chromium"],"license":"MIT","dependencies":{"got":"^11.5.1","http-proxy-agent":"^4.0.1","https-proxy-agent":"^5.0.0","socks-proxy-agent":"^5.0.0","tough-cookie":"^4.0.0"},"gitHead":"bd8e520f3713c7bd759c2b897313423ca2895eb9","bugs":{"url":"https://github.com/Cuadrix/puppeteer-page-proxy/issues"},"_id":"@doridian/puppeteer-page-proxy@1.2.9","_nodeVersion":"14.15.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-tWdi7L3dDDFPliSpr0LpYtWjpYV3n8ritzg0XgwSUMt8BGCwJk+GP2YwPjNLmXEDe2lr/Gw+UJ/Abrxa75I60Q==","shasum":"4ff9ff968a765649fcfa8f57db2a27c8d0bae77f","tarball":"https://registry.npmjs.org/@doridian/puppeteer-page-proxy/-/puppeteer-page-proxy-1.2.9.tgz","fileCount":11,"unpackedSize":24106,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf16OoCRA9TVsSAnZWagAAPPoQAIMjadF700K3l5J+wNtT\naMaIe3Kp5tLuu8DWLWNpJV6G4U80Z/OUinfqVKSp9+KkhjjoA/BSzzJOA3hU\nNUYZ9kp1YcLejtCH3CIzAzJwAIyE0dH0vBa4DBWjUJKDUaSeCGuxPOi0I1Sa\n2uPtwXtMBmUgHq/QpYvIV0UnVYQIuH6IysNodopYBnqcMYM1lDzzM1Dn+w86\n66/LFYeccmJJw9GsXFqd/FGY6bPCaFmlXQfksLKp4oZXLM6IaK88qeNdpUvp\nYBlKJfhqdQGiy825d6snCstGUEP/3XpJF9MpweXvCR8sUDFyFRqCDTFceax6\n5yQ42jY5UM/H7PAUO/E3mw3mhGxwfZBqhHWfKEvZtJhlng0l+cgNqr1YyUIt\nEHohlD4l0k1brfuX6mm1Pp1B3FkNFASNDN5+KzCK8PhiTjO3mYG9T1bPs0hl\nNZ+mK1c7Ui48MBZKigrFn8pDdZUn50uPTsgNQ/3Q6p//gTcmP9P+EHFhLApp\ny6NnYulx1vz0zWicLZPRNPkWcMBmT7Gtvlft+r819dtZEx5Co03Xcglq3Eg5\nwVlDStZOdOh8hEcm3zy4vPoL8VSguA1KpHbvGRq4mMh4xViUz+BNG0lqTv8g\nTPkuBKBnbFULOQ/Ovqjv9Duou/b7tw8EipzX+jR0k3PnphfYrx+Vv5wxLVUp\nXUeN\r\n=DNKo\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHgIc+pgOyRoDCZefxNGuLdc6cIkq26clavGBDWPVrOlAiEAi4cSQqQr/8pNAo+nweeg24PNOpFdoaKcH65o5Cr/TRQ="}]},"_npmUser":{"name":"doridian","email":"mriq91@gmail.com"},"directories":{},"maintainers":[{"name":"doridian","email":"mriq91@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-page-proxy_1.2.9_1607967655967_0.4632997152168361"},"_hasShrinkwrap":false},"1.2.10":{"name":"@doridian/puppeteer-page-proxy","description":"Additional Node.js module to use with 'puppeteer' for setting proxies per page basis.","version":"1.2.10","author":{"name":"Cuadrix","email":"cuadrix12000@gmail.com","url":"https://github.com/Cuadrix"},"homepage":"https://github.com/Cuadrix/puppeteer-page-proxy","main":"./src/index.js","types":"./src/index.d.ts","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/Cuadrix/puppeteer-page-proxy.git"},"keywords":["puppeteer","proxy","page","headless","chromium"],"license":"MIT","dependencies":{"got":"^11.5.1","http-proxy-agent":"^4.0.1","https-proxy-agent":"^5.0.0","socks-proxy-agent":"^5.0.0","tough-cookie":"^4.0.0"},"gitHead":"6081c3d6c9719a9f89590b54a141e790e6922773","bugs":{"url":"https://github.com/Cuadrix/puppeteer-page-proxy/issues"},"_id":"@doridian/puppeteer-page-proxy@1.2.10","_nodeVersion":"14.15.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-+Oc2JYaI00gaPtUfgMrCLpqBtr5MmzSWny0LYrvFqTsXUUMJqvkB3LJdVGeo24UzyB+TPJV7aQOJkZVEPeUP3A==","shasum":"757dda06970a98d8b92dfb66383ee5e99cb87c1a","tarball":"https://registry.npmjs.org/@doridian/puppeteer-page-proxy/-/puppeteer-page-proxy-1.2.10.tgz","fileCount":11,"unpackedSize":24146,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf16YLCRA9TVsSAnZWagAADKwP/3bAcQpbM6DTkQ+PBdJa\nRlSHUXGyZ+TZol4l7E5L58lw+Gy3kS/sZ6422SO0ktJXLoLWEpBko1mQ3oWg\n+g8gK1zRiwhU32mTuZhwqZAocN0/JvkY1WIWxmgtGQVFZMXa0OESgXSdPbBC\nhSKSbZ9j0eBGmRMhwIMjYNLuyuteWSSot/nuEx/nsgHwLrib10IQ+qJi5tNd\nQGRPHgsnwgKoKB/l3SkYL9nXDIszvjYMa197tysjNfBgWkRiRoWksBN7iCKh\nPSBMQzqWx5JDgUy3DY50WB1SZzqBKv6Jnim5esWklreRn/U6s4Z4zY9g7AV1\n6mU6dqa9frk6BEeWNLMn/L/vJq8VO2AqRVEMld9kd5hrRZZhvpJ03/TpesF2\nx1ptkTiJY+IJ87if3MPERIhymAdY3g/O924MZZzg2lAyBJ3kkW9MQkRGKwW0\nofMae4stz+1vXF/bZkM2KJ5FtMok4Qkp62/jSGpLSeNB37CwBknCMaJEZjY0\nkMtDCS2YK870+h+bYgzikG8yOCfGIyStBuSx0SKqPj2qG8l5cTEN2H8pdqil\nF4m8lLf3VJwkPa0MtAfgG+nc/0+KdMi6FxPeafbVSdKlSi30Nk91SeK8FhXS\nL6Q+ndSRzjJuK83NpcfeV4YsxqwzQ8gu1xg4gpReQQjvvglmQVDgzPfaraJS\nF497\r\n=W1Hg\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBogtzO2LOpjZUpiY0ZFvMKPDOwD0zMmWGywHlTVD/TpAiBDn+qDh6HKCLSVsv3GxLtqkG78dorPYE7JKUMdED66nw=="}]},"_npmUser":{"name":"doridian","email":"mriq91@gmail.com"},"directories":{},"maintainers":[{"name":"doridian","email":"mriq91@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-page-proxy_1.2.10_1607968267321_0.1151016745871325"},"_hasShrinkwrap":false},"1.2.11":{"name":"@doridian/puppeteer-page-proxy","description":"Additional Node.js module to use with 'puppeteer' for setting proxies per page basis.","version":"1.2.11","author":{"name":"Cuadrix","email":"cuadrix12000@gmail.com","url":"https://github.com/Cuadrix"},"homepage":"https://github.com/Cuadrix/puppeteer-page-proxy","main":"./src/index.js","types":"./src/index.d.ts","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/Cuadrix/puppeteer-page-proxy.git"},"keywords":["puppeteer","proxy","page","headless","chromium"],"license":"MIT","dependencies":{"got":"^11.5.1","http-proxy-agent":"^4.0.1","https-proxy-agent":"^5.0.0","socks-proxy-agent":"^5.0.0","tough-cookie":"^4.0.0"},"gitHead":"09c868ad93cd7040c2c2ba1c90935a49335228e5","bugs":{"url":"https://github.com/Cuadrix/puppeteer-page-proxy/issues"},"_id":"@doridian/puppeteer-page-proxy@1.2.11","_nodeVersion":"14.15.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-hnv72hr2dET21BfZif3TK/NteGo45ovthlKF08oLt+z6p421I8pBTyAqcYMcMIUlINx8rZGFjn6iCcvO616bGg==","shasum":"7ebd75a2205f4cc29752fb57db378f59c63488dd","tarball":"https://registry.npmjs.org/@doridian/puppeteer-page-proxy/-/puppeteer-page-proxy-1.2.11.tgz","fileCount":11,"unpackedSize":24141,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf3BtLCRA9TVsSAnZWagAA07sP/3UrQ2RUS3MHX0DWAJiZ\nmU48jrw8txae/zGLvC2NhO00trelm7UEbWWNEpAshH7ajZRNtaHT5uFCdspH\n8ULAY9NWgFV8CC5DVYpkThlofKsGPf+wabxXu0LLerJXpmPU0Eja0dUJFJ0K\n6UKocXiOcxdg+fHusSnNkwhQqzZjpPMub8btIjmmhpRZFMYAeij+zxhw1GuO\n2IoapAUO272lq4vgQliHoeAMBeIQmVGAtw0fNbnV32AxKTBPkwinGbs36st/\njL8cQGl0I8Eub873d2TU6ogJr2V+Aa2JJOl3OoJPJRx8sDzlNdxEZ7K+nxlJ\n+UTqZicYVpPW8wslnp5iZwuUWB1Ux1CRxK3hC0kF5YhOUDETIyLDzm1koEW+\n3ohXp/BNMFeGmx/ABPrQcNSXUi4lvup7LtnazvqXcEyXoOnR4r8pLZUjbA2F\nJPkcusSoC11E+AqzFccVKeOwpe8Ez7qqutl/YjzQIvuHZswcIZTtuUtrE/Uw\nBMJya0ZDucHOjsSa94fB/t/6EO8vKfs5I/NI67AJjoR14cRujif5bdVv/o/2\nTagfMRQDSnYVc+54ak0uEMj8s3q3S7m9EJXYUxP3GHH5GwiJ9GEQ/voNCObg\noYx5IMJhvxt2uITfYJR2BuXLWpqLjun0rDEhJ0pTeMxo/UUZtL2H2lUvAv+o\nZofx\r\n=6Q2+\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC0Ukbr4DGFg+uuB59X0XweZ25e6odLxsJVN9qXh9MdfgIgDqQAsQ0kv3aS6RkvXIYacLah+5/hMeNmJfhcqsS/JoA="}]},"_npmUser":{"name":"doridian","email":"mriq91@gmail.com"},"directories":{},"maintainers":[{"name":"doridian","email":"mriq91@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-page-proxy_1.2.11_1608260426788_0.1345435519508711"},"_hasShrinkwrap":false}},"time":{"created":"2020-12-14T17:40:55.910Z","1.2.9":"2020-12-14T17:40:56.074Z","modified":"2022-04-05T05:26:53.650Z","1.2.10":"2020-12-14T17:51:07.524Z","1.2.11":"2020-12-18T03:00:26.902Z"},"maintainers":[{"name":"doridian","email":"mriq91@gmail.com"}],"description":"Additional Node.js module to use with 'puppeteer' for setting proxies per page basis.","homepage":"https://github.com/Cuadrix/puppeteer-page-proxy","keywords":["puppeteer","proxy","page","headless","chromium"],"repository":{"type":"git","url":"git+https://github.com/Cuadrix/puppeteer-page-proxy.git"},"author":{"name":"Cuadrix","email":"cuadrix12000@gmail.com","url":"https://github.com/Cuadrix"},"bugs":{"url":"https://github.com/Cuadrix/puppeteer-page-proxy/issues"},"license":"MIT","readme":"# puppeteer-page-proxy <img src=\"https://i.ibb.co/kQrN9QJ/puppeteer-page-proxy-logo.png\" align=\"right\" width=\"150\" height=\"150\">\nAdditional Node.js module to use with **[puppeteer](https://www.npmjs.com/package/puppeteer)** for setting proxies per page basis.\n\nForwards 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.\n\n## Features\n\n- Proxy per page and proxy per request\n- Supports **http**, **https**, **socks4** and **socks5** proxies\n- Supports authentication\n- Handles cookies\n\n## Installation\n```\nnpm i puppeteer-page-proxy\n```\n## API\n#### PageProxy(pageOrReq, proxy)\n\n- `pageOrReq` <[object](https://developer.mozilla.org/en-US/docs/Glossary/Object)> 'Page' or 'Request' object to set a proxy for.\n- `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.\n  * Begins with a protocol (e.g. http://, https://, socks://)\n  * 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:\\\n`url`, `method`, `postData`, `headers`\\\nSee [httpRequest.continue](https://github.com/puppeteer/puppeteer/blob/main/docs/api.md#httprequestcontinueoverrides) for more info about the above properties.\n  \n#### PageProxy.lookup(page[, lookupService, isJSON, timeout])\n\n- `page` <[object](https://developer.mozilla.org/en-US/docs/Glossary/Object)> 'Page' object to execute the request on.\n- `lookupService` <[string](https://developer.mozilla.org/en-US/docs/Glossary/String)> External lookup service to request data from.\n  * Fetches data from **api64.ipify.org** by default.\n- `isJSON` <[boolean](https://developer.mozilla.org/en-US/docs/Glossary/Boolean)> Whether to [JSON.parse](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse) the received response.\n  * Defaults to **true**.\n- `timeout` <[number](https://developer.mozilla.org/en-US/docs/Glossary/Number)|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)> Time in milliseconds after which the request times out.\n  * Defaults to **30000**.\n- returns: <[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)> Promise which resolves to the response of the lookup request.\n\n**NOTE:** By default this method expects a response in [JSON](https://en.wikipedia.org/wiki/JSON#Example) format and [JSON.parse](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse)'s it to a usable javascript object. To disable this functionality, set `isJSON` to `false`.\n    \n## Usage\n#### Importing:\n```js\nconst useProxy = require('puppeteer-page-proxy');\n```\n\n#### Proxy per page:\n```js\nawait useProxy(page, 'http://127.0.0.1:80');\n```\nTo remove proxy, omit or pass in falsy value (e.g `null`):\n```js\nawait useProxy(page, null);\n```\n\n#### Proxy per request:\n```js\nawait page.setRequestInterception(true);\npage.on('request', async request => {\n    await useProxy(request, 'https://127.0.0.1:443');\n});\n```\nThe request object itself is passed as the first argument. The proxy can now be changed every request.\n\nUsing it along with other interception methods:\n```js\nawait page.setRequestInterception(true);\npage.on('request', async request => {\n    if (request.resourceType() === 'image') {\n        request.abort();\n    } else {\n        await useProxy(request, 'socks4://127.0.0.1:1080');\n    }\n});\n```\n\nOverriding requests:\n```js\nawait page.setRequestInterception(true);\npage.on('request', async request => {\n    await useProxy(request, {\n        proxy: 'socks5://127.0.0.1:1080',\n        url: 'https://example.com',\n        method: 'POST',\n        postData: '404',\n        headers: {\n            accept: 'text/html'\n        }\n    });\n});\n```\n\n**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.\n\n#### Authenticating:\n```js\nconst proxy = 'https://user:pass@host:port';\n```\n\n#### IP lookup:\n```js\n// 1. Waits until done, 'then' continues\nconst data = await useProxy.lookup(page1);\n    console.log(data.ip);\n    \n// 2. Executes and 'comes back' once done\nuseProxy.lookup(page2).then(data => {\n    console.log(data.ip);\n});\n```\nIn case of any [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) errors, use `--disable-web-security` launch flag:\n```js\nconst browser = await puppeteer.launch({\n    args: ['--disable-web-security']\n});\n```\n\n## FAQ\n#### How does this module work?\n\nIt takes over the task of requesting content **from** the browser to do it internally via a requests library instead. Requests that are normally made by the browser, are thus made by Node. The IP's are changed by routing the requests through the specified proxy servers using ***-proxy-agent's**. When Node gets a response back from the server, it's forwarded to the browser for completion/rendering.\n\n#### Why am I getting _\"Request is already handled!\"_?\n\nThis 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.\n\n\n#### Why does the browser show _\"Your connection to this site is not secure\"_?\n\nBecause direct requests from the browser to the server are being intercepted by Node, making the establishment of a secure connection between them impossible. However, the requests aren't made by the browser, they are made by Node. All `https` requests made through Node using this module are secure. This is evidenced by the connection property of the response object:\n\n\n```\nconnection: TLSSocket {\n    _tlsOptions: {\n        secureContext: [SecureContext],\n        requestCert: true,\n        rejectUnauthorized: true,\n    },\n    _secureEstablished: true,\n    authorized: true,\n    encrypted: true,\n}\n```\nYou can think of the warning as a false positive.\n\n## Dependencies\n- [Got](https://github.com/sindresorhus/got)\n- [http-proxy-agent](https://github.com/TooTallNate/node-http-proxy-agent)\n- [https-proxy-agent](https://github.com/TooTallNate/node-https-proxy-agent)\n- [socks-proxy-agent](https://github.com/TooTallNate/node-socks-proxy-agent)\n- [tough-cookie](https://github.com/salesforce/tough-cookie)\n","readmeFilename":"README.md"}