cloudflare-scraper
Advanced tools
Comparing version 1.0.4 to 1.0.5
{ | ||
"name": "cloudflare-scraper", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "A package to bypass Cloudflare's protection", | ||
@@ -5,0 +5,0 @@ "author": "Jimmy Laurent", |
@@ -32,3 +32,10 @@ const { addExtra } = require('puppeteer-extra'); | ||
async function createBrowser({ proxy = HTTP_PROXY || HTTPS_PROXY }) { | ||
async function createBrowser(options) { | ||
const { proxy = HTTP_PROXY || HTTPS_PROXY, browserWSEndpoint, browserUrl } = options; | ||
const ignoreHTTPSErrors = PUPPETEER_IGNORE_HTTPS_ERROR === 'true'; | ||
if (browserWSEndpoint || browserUrl) { | ||
return puppeteer.connect({ browserWSEndpoint, browserUrl, ignoreHTTPSErrors }); | ||
} | ||
const args = ['--no-sandbox', '--disable-setuid-sandbox', '--user-agent=' + getUserAgent()]; | ||
@@ -41,3 +48,3 @@ if (proxy) { | ||
headless: PUPPETEER_HEADLESS === 'true', | ||
ignoreHTTPSErrors: PUPPETEER_IGNORE_HTTPS_ERROR === 'true', | ||
ignoreHTTPSErrors, | ||
args | ||
@@ -44,0 +51,0 @@ }; |
@@ -25,6 +25,6 @@ const createBrowser = require('./createBrowser'); | ||
async function fillCookiesJar(request, options) { | ||
let { proxy, jar, url, uri } = options; | ||
let { jar, url, uri } = options; | ||
url = url || uri; | ||
const browser = await createBrowser({ proxy }); | ||
const browser = await createBrowser(options); | ||
try { | ||
@@ -31,0 +31,0 @@ const page = await browser.newPage(); |
10905
245