antibotbrowser 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -36
- package/index.js +9 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ const antibotbrowser = require("antibotbrowser");
|
|
|
12
12
|
|
|
13
13
|
## 3 - And let's run our browser
|
|
14
14
|
```js
|
|
15
|
-
|
|
15
|
+
antibrowser = antibotbrowser.startbrowser();
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
## END - Connect the browser to puppeteer with websocket
|
|
@@ -24,7 +24,7 @@ const puppeteer = require('puppeteer');
|
|
|
24
24
|
|
|
25
25
|
const antibrowser = await antibotbrowser.startbrowser();
|
|
26
26
|
|
|
27
|
-
const browser = await puppeteer.connect({browserWSEndpoint:
|
|
27
|
+
const browser = await puppeteer.connect({browserWSEndpoint: antibrowser.websokcet});
|
|
28
28
|
|
|
29
29
|
// Normal use from now on
|
|
30
30
|
const page = await browser.newPage();
|
|
@@ -37,19 +37,6 @@ const puppeteer = require('puppeteer');
|
|
|
37
37
|
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
-
## Arguments
|
|
41
|
-
```js
|
|
42
|
-
antibotbrowser.startbrowser(port, url);
|
|
43
|
-
// 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.
|
|
44
|
-
|
|
45
|
-
// url: The first page address on browser startup. If you leave it blank, it defaults to google.com.
|
|
46
|
-
|
|
47
|
-
// Examples
|
|
48
|
-
antibotbrowser.startbrowser(9223, "https://github.com");
|
|
49
|
-
antibotbrowser.startbrowser(9222, "https://google.com");
|
|
50
|
-
// note do not start 2 scanners on the same port!!!
|
|
51
|
-
```
|
|
52
|
-
|
|
53
40
|
## Example uses
|
|
54
41
|
1-
|
|
55
42
|
```js
|
|
@@ -59,7 +46,7 @@ const puppeteer = require('puppeteer');
|
|
|
59
46
|
|
|
60
47
|
const antibrowser = await antibotbrowser.startbrowser(); // We start the browser with default settings. Port: 9222 Url: google.com
|
|
61
48
|
|
|
62
|
-
const browser = await puppeteer.connect({browserWSEndpoint:
|
|
49
|
+
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 .
|
|
63
50
|
|
|
64
51
|
// Normal use from now on
|
|
65
52
|
const page = await browser.newPage();
|
|
@@ -70,26 +57,16 @@ const puppeteer = require('puppeteer');
|
|
|
70
57
|
|
|
71
58
|
})();
|
|
72
59
|
```
|
|
73
|
-
2-
|
|
74
|
-
```js
|
|
75
|
-
const antibotbrowser = require("antibotbrowser");
|
|
76
|
-
const puppeteer = require('puppeteer');
|
|
77
|
-
(async () => {
|
|
78
|
-
|
|
79
|
-
const antibrowser = await antibotbrowser.startbrowser(9222, "https://google.com"); // We start the browser | Port: 9222 Url: google.com
|
|
80
|
-
const antibrowser2 = await antibotbrowser.startbrowser(9223, "https://github.com"); // 2. We create a browser | Port: 9223 Url: google.com
|
|
81
|
-
|
|
82
|
-
const browser = await puppeteer.connect({browserWSEndpoint: antibotbrowser.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 .
|
|
83
60
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
const page = await browser.newPage();
|
|
89
|
-
|
|
90
|
-
await page.setViewport({width:0, height:0});
|
|
91
|
-
|
|
92
|
-
page.goto("https://google.com")
|
|
61
|
+
## Arguments
|
|
62
|
+
```js
|
|
63
|
+
antibotbrowser.startbrowser(port, url);
|
|
64
|
+
// 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.
|
|
93
65
|
|
|
94
|
-
|
|
66
|
+
// url: The first page address on browser startup. If you leave it blank, it defaults to google.com.
|
|
67
|
+
|
|
68
|
+
// Examples
|
|
69
|
+
antibotbrowser.startbrowser(9223, "https://github.com");
|
|
70
|
+
antibotbrowser.startbrowser(9222, "https://google.com");
|
|
71
|
+
// note do not start 2 scanners on the same port!!!
|
|
95
72
|
```
|
package/index.js
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
const chromium = require('chromium');
|
|
2
2
|
const {execFile} = require('child_process');
|
|
3
3
|
var request = require('sync-request');
|
|
4
|
+
const fs = require('fs');
|
|
4
5
|
|
|
5
6
|
// github.com/reloxe
|
|
6
7
|
// nokersoft.com
|
|
7
8
|
|
|
9
|
+
versioncehck();
|
|
10
|
+
async function versioncehck() {
|
|
11
|
+
var versioncheck = await request('GET', `https://registry.npmjs.org/antibotbrowser/latest`);
|
|
12
|
+
if (JSON.parse(versioncheck.getBody())['version'] != JSON.parse(fs.readFileSync('package.json'))['version']) {
|
|
13
|
+
console.log("[Notification] AntiBotBrowser New Version Available !");
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
8
17
|
const delay = ms => new Promise(resolve => setTimeout(resolve, ms))
|
|
9
18
|
|
|
10
19
|
async function startbrowser(port, url) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "antibotbrowser",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"readme": "README.md",
|
|
5
5
|
"description": "Opening Chromium opens a real browser without bot validations in automated systems like Puppetter. To avoid problems in places like Cloudflare",
|
|
6
6
|
"main": "index.js",
|