websbrowser

1.0.12 • Public • Published

Usage

1 - First let's start by installing the module

npm install antibotbrowser

2 - Let's include our module in our project

const antibotbrowser = require("antibotbrowser");

3 - And let's run our browser

antibrowser = antibotbrowser.startbrowser();

END - Connect the browser to puppeteer with websocket

const antibotbrowser = require("antibotbrowser");
const puppeteer = require("puppeteer");

(async () => {
  const antibrowser = await antibotbrowser.startbrowser();

  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 });

  page.goto("https://google.com");
})();

Example uses

1-

const antibotbrowser = require("antibotbrowser");
const puppeteer = require("puppeteer");
(async () => {
  const antibrowser = await antibotbrowser.startbrowser(); // We start the browser with default settings. Port: 9222 Url: google.com

  const browser = await puppeteer.connect({
    browserWSEndpoint: antibrowser.websokcet,
  }); // We connect the launched browser to puppeteer. With the variable we created above, it gives the web socket url to puppetter with antibotbrowser.websocket  .

  // Normal use from now on
  const page = await browser.newPage();

  await page.setViewport({ width: 0, height: 0 });

  page.goto("https://google.com");
})();

Arguments

antibotbrowser.startbrowser(port, url);
// port: The debugging port is the debugging port of the chromium browser. There can be 1 browser on the same port number, so you can add it as an argument. By default, if you enter nothing, the port is 9222.

// url: The first page address on browser startup. If you leave it blank, it defaults to google.com.

// Examples
antibotbrowser.startbrowser(9223, "https://github.com");
antibotbrowser.startbrowser(9222, "https://google.com");
// note do not start 2 scanners on the same port!!!

Readme

Keywords

none

Package Sidebar

Install

npm i websbrowser

Weekly Downloads

0

Version

1.0.12

License

ISC

Unpacked Size

3.65 kB

Total Files

3

Last publish

Collaborators

  • kitsonmac