puppeteer-real-browser
Advanced tools
Comparing version 1.3.20 to 1.3.21
@@ -1,4 +0,9 @@ | ||
var puppeteer = require("rebrowser-puppeteer-core"); | ||
const puppeteer = require("rebrowser-puppeteer-core"); | ||
const { pageController } = require("./module/pageController.js"); | ||
const Xvfb = require("xvfb"); | ||
let Xvfb | ||
try { | ||
Xvfb = require("xvfb"); | ||
} catch { | ||
// ignore | ||
} | ||
@@ -15,3 +20,3 @@ async function connect({ | ||
ignoreAllFlags = false, | ||
}) { | ||
} = {}) { | ||
const { launch, Launcher } = await import("chrome-launcher"); | ||
@@ -37,29 +42,34 @@ | ||
let chromeFlags; | ||
if (ignoreAllFlags === true) { | ||
chromeFlags = [ | ||
...args, | ||
...(headless !== false ? [`--headless=${headless}`] : []), | ||
...(proxy && proxy.host && proxy.port | ||
? [`--proxy-server=${proxy.host}:${proxy.port}`] | ||
: []), | ||
]; | ||
} else { | ||
// Default flags: https://github.com/GoogleChrome/chrome-launcher/blob/main/src/flags.ts | ||
const flags = Launcher.defaultFlags(); | ||
// Add AutomationControlled to "disable-features" flag | ||
const indexDisableFeatures = flags.findIndex((flag) => flag.startsWith('--disable-features')); | ||
flags[indexDisableFeatures] = `${flags[indexDisableFeatures]},AutomationControlled`; | ||
// Remove "disable-component-update" flag | ||
const indexComponentUpdateFlag = flags.findIndex((flag) => flag.startsWith('--disable-component-update')); | ||
flags.splice(indexComponentUpdateFlag, 1); | ||
chromeFlags = [ | ||
...flags, | ||
...args, | ||
...(headless !== false ? [`--headless=${headless}`] : []), | ||
...(proxy && proxy.host && proxy.port | ||
? [`--proxy-server=${proxy.host}:${proxy.port}`] | ||
: []), | ||
"--no-sandbox", | ||
"--disable-dev-shm-usage", | ||
]; | ||
} | ||
const chrome = await launch({ | ||
ignoreDefaultFlags: true, | ||
chromeFlags: [ | ||
...(ignoreAllFlags === true | ||
? [ | ||
...(proxy && proxy.host && proxy.port | ||
? [`--proxy-server=${proxy.host}:${proxy.port}`] | ||
: []), | ||
...args, | ||
...(headless !== false ? [`--headless=${headless}`] : []), | ||
] | ||
: [ | ||
...Launcher.defaultFlags().filter( | ||
(item) => | ||
!item.includes("--disable-features") && | ||
!item.includes("component-update") | ||
), | ||
...args, | ||
...(headless !== false ? [`--headless=${headless}`] : []), | ||
...(proxy && proxy.host && proxy.port | ||
? [`--proxy-server=${proxy.host}:${proxy.port}`] | ||
: []), | ||
"--disable-features=Translate,OptimizationHints,MediaRouter,DialMediaRouteProvider,CalculateNativeWinOcclusion,InterestFeedContentSuggestions,CertificateTransparencyComponentUpdater,AutofillServerCommunication,PrivacySandboxSettings4,AutomationControlled", | ||
"--no-sandbox", | ||
"--disable-dev-shm-usage", | ||
]), | ||
], | ||
chromeFlags, | ||
...customConfig, | ||
@@ -66,0 +76,0 @@ }); |
{ | ||
"name": "puppeteer-real-browser", | ||
"version": "1.3.20", | ||
"version": "1.3.21", | ||
"description": "This package is designed to bypass puppeteer's bot-detecting captchas such as Cloudflare. It acts like a real browser and can be managed with puppeteer.", | ||
@@ -45,5 +45,15 @@ "main": "lib/cjs/index.js", | ||
"rebrowser-puppeteer-core": "^23.3.1", | ||
"tree-kill": "^1.2.2", | ||
"tree-kill": "^1.2.2" | ||
}, | ||
"devDependencies": { | ||
"xvfb": "^0.4.0" | ||
}, | ||
"peerDependencies": { | ||
"xvfb": "*" | ||
}, | ||
"peerDependenciesMeta": { | ||
"xvfb": { | ||
"optional": true | ||
} | ||
}, | ||
"repository": { | ||
@@ -50,0 +60,0 @@ "type": "git", |
@@ -59,3 +59,3 @@ <br/> | ||
const start = async () => { | ||
const { page, browser } = await connect({}) | ||
const { page, browser } = await connect() | ||
} | ||
@@ -70,3 +70,3 @@ | ||
const { page, browser } = await connect({}) | ||
const { page, browser } = await connect() | ||
@@ -73,0 +73,0 @@ ``` |
Sorry, the diff of this file is not supported yet
AI-detected possible typosquat
Supply chain riskAI has identified this package as a potential typosquat of a more popular package. This suggests that the package may be intentionally mimicking another package's name, description, or other metadata.
Found 1 instance in 1 package
220182
670
1
1
- Removedxvfb@^0.4.0