antibotbrowser 3.0.3 → 3.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/index.js +20 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -8,6 +8,16 @@ const path = require('path');
|
|
|
8
8
|
// github.com/reloxe
|
|
9
9
|
// nokersoft.com
|
|
10
10
|
|
|
11
|
+
const tempProfiles = new Set();
|
|
12
|
+
const cleanAll = () => {
|
|
13
|
+
tempProfiles.forEach(p => {
|
|
14
|
+
try { if (fs.existsSync(p)) fs.rmSync(p, { recursive: true, force: true }); } catch (e) { }
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
process.on('exit', cleanAll);
|
|
19
|
+
['SIGINT', 'SIGTERM', 'SIGHUP'].forEach(sig => process.on(sig, () => process.exit()));
|
|
20
|
+
|
|
11
21
|
versioncehck();
|
|
12
22
|
async function versioncehck() {
|
|
13
23
|
try {
|
|
@@ -34,6 +44,10 @@ async function startbrowser(options) {
|
|
|
34
44
|
}
|
|
35
45
|
const tempProfile = path.join(baseDir, profileName);
|
|
36
46
|
|
|
47
|
+
if (!userdata) {
|
|
48
|
+
tempProfiles.add(tempProfile);
|
|
49
|
+
}
|
|
50
|
+
|
|
37
51
|
var args = [
|
|
38
52
|
'--remote-debugging-port=' + port,
|
|
39
53
|
'--user-data-dir=' + tempProfile
|
|
@@ -44,7 +58,12 @@ async function startbrowser(options) {
|
|
|
44
58
|
|
|
45
59
|
try {
|
|
46
60
|
execFile(chromium.path, args, (err) => {
|
|
47
|
-
if (
|
|
61
|
+
if (!userdata) {
|
|
62
|
+
try {
|
|
63
|
+
fs.rmSync(tempProfile, { recursive: true, force: true });
|
|
64
|
+
tempProfiles.delete(tempProfile);
|
|
65
|
+
} catch (e) { }
|
|
66
|
+
}
|
|
48
67
|
});
|
|
49
68
|
} catch (e) { }
|
|
50
69
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "antibotbrowser",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.4",
|
|
4
4
|
"description": "Opening Chromium opens a real browser without bot validations in automated systems like Puppeteer. To avoid problems in places like Cloudflare",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|