antibotbrowser
v4.0.1
Published
Opening Chromium opens a real browser without bot validations in automated systems like Puppeteer. To avoid problems in places like Cloudflare
Downloads
269
Maintainers
Readme
This library is designed to behave like a real browser, allowing you to bypass Cloudflare Challenges and other bot verification systems that often block traditional automated tools.
This is for educational purposes only. Bypassing systems like bot verification may be illegal. User responsibility lies with the user.
Note: This package is compatible with Puppeteer, Playwright, and any other automation framework that supports the Chrome DevTools Protocol (CDP).
Usage
1 - First let's start by installing the module
npm install antibotbrowser2 - Let's include our module in our project
const antibotbrowser = require("antibotbrowser");3 - And let's run our browser
// Default use (Port: 9222)
var antibrowser = await antibotbrowser.startbrowser(9222);
// Advanced use with options
var antibrowser = await antibotbrowser.startbrowser({
port: 9222, // Default: 9222 (Optional)
userdata: true, // true, false or "custom_profile_name" (Optional)
headless: true, // headless mode (Default: false) (Optional)
nosandbox: true // no-sandbox mode (Default: false) (Optional)
});If
userdataistrue, the browser will use a default persistent profile to save your session (cookies, history, etc.). You can also pass a string like"my_profile"to create and use a specific persistent folder for the profile. Iffalse, it will use a temporary profile that is deleted when the browser is closed.
END - Connect the browser to puppeteer with websocket
const antibotbrowser = require("antibotbrowser");
const puppeteer = require('puppeteer');
(async () => {
const antibrowser = await antibotbrowser.startbrowser({
port: 9222,
headless: false
});
const browser = await puppeteer.connect({browserWSEndpoint: antibrowser.websokcet});
// Normal use from now on
const page = await browser.newPage();
await page.setViewport({width:0, height:0});
await page.goto("https://www.nokersoft.com")
})();Troubleshooting and General Information
- Linux / Server Usage: If you are running on a Linux server without a GUI (e.g., Ubuntu Server), you must use the
headless: trueoption. - Root User: If you are running the script as a
rootuser, Chromium may fail to start due to security restrictions. In this case, use thenosandbox: trueoption. - Port Conflicts: If the default port
9222is already in use by another application, you can specify a different port using theportoption (e.g.,9333). - Dependencies: Ensure that your system has the necessary dependencies installed for Chromium to run (especially on minimal Linux distributions).
Usage with custom flags
If you want to add your own Chromium flags, you can use the flags option.
var antibrowser = await antibotbrowser.startbrowser({
port: 9222,
flags: ["--incognito", "--disable-notifications"]
});Commonly used flags:
"--incognito": Opens the browser in incognito mode (does not save cookies or history)."--disable-notifications": Disables web notifications."--mute-audio": Mutes all audio coming from the browser."--window-size=1920,1080": Starts the browser with a specific window resolution."--disable-gpu": Disables hardware acceleration (useful for server-side or headless environments).
Example uses
const antibotbrowser = require("antibotbrowser");
const puppeteer = require('puppeteer');
(async () => {
const antibrowser = await antibotbrowser.startbrowser(9222); // We start the browser with settings Port: 9222
const browser = await puppeteer.connect({browserWSEndpoint: antibrowser.websokcet}); // We connect the launched browser to puppeteer.
// Normal use from now on
const page = await browser.newPage();
await page.setViewport({width:0, height:0});
await page.goto("https://www.nokersoft.com")
})();Usage with Playwright
const { chromium } = require('playwright');
const antibotbrowser = require("antibotbrowser");
(async () => {
const antibrowser = await antibotbrowser.startbrowser(9222);
// Connect Playwright to the launched browser via CDP
const browser = await chromium.connectOverCDP(`http://localhost:9222`);
const context = browser.contexts()[0];
const page = context.pages()[0] || await context.newPage();
await page.goto("https://www.nokersoft.com");
console.log("Page title:", await page.title());
})();Important Notes
Regarding imitation and fake packages: I've seen a few people publishing exact copies of our npm package under different names. Using these packages could pose security risks. Always use the original package developed by Nokersoft. (If you search for "antibotbrowser" in npm, you might find fake npm packages. Be careful and report them.)
