@naturalcycles/js-lib 14.267.0 → 14.267.2
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/dist/bot.js +1 -1
- package/dist/http/fetcher.js +4 -1
- package/dist-esm/bot.js +1 -1
- package/dist-esm/http/fetcher.js +4 -1
- package/package.json +1 -1
- package/src/bot.ts +1 -1
- package/src/http/fetcher.ts +5 -1
package/dist/bot.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
exports.BotReason = exports.BotDetectionService = void 0;
|
|
6
6
|
const env_1 = require("./env");
|
|
7
|
-
const botRegex = /bot|spider|crawl|headless|electron|phantom|slimer|proximic|cincraw|
|
|
7
|
+
const botRegex = /bot|spider|crawl|headless|electron|phantom|slimer|proximic|cincraw|slurp|MicrosoftPreview|ahrefs|preview|lighthouse|facebookexternal|pinterest|screaming|apis-google|duplexweb-google|feedfetcher-google|google-read-aloud|googleweblight|mediapartners-google/i;
|
|
8
8
|
/**
|
|
9
9
|
* Service to detect bots and CDP (Chrome DevTools Protocol).
|
|
10
10
|
*
|
package/dist/http/fetcher.js
CHANGED
|
@@ -124,7 +124,10 @@ class Fetcher {
|
|
|
124
124
|
variables: opt.variables,
|
|
125
125
|
});
|
|
126
126
|
// Checking the query length, and not allowing to use GET if above 1900
|
|
127
|
-
if (opt.method === 'GET' && opt.query.length
|
|
127
|
+
if (opt.method === 'GET' && opt.query.length > 1900) {
|
|
128
|
+
opt.method = 'POST';
|
|
129
|
+
}
|
|
130
|
+
if (opt.method === 'GET') {
|
|
128
131
|
opt.searchParams = {
|
|
129
132
|
...opt.searchParams,
|
|
130
133
|
...payload,
|
package/dist-esm/bot.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Relevant material:
|
|
2
2
|
// https://deviceandbrowserinfo.com/learning_zone/articles/detecting-headless-chrome-puppeteer-2024
|
|
3
3
|
import { isServerSide } from './env';
|
|
4
|
-
const botRegex = /bot|spider|crawl|headless|electron|phantom|slimer|proximic|cincraw|
|
|
4
|
+
const botRegex = /bot|spider|crawl|headless|electron|phantom|slimer|proximic|cincraw|slurp|MicrosoftPreview|ahrefs|preview|lighthouse|facebookexternal|pinterest|screaming|apis-google|duplexweb-google|feedfetcher-google|google-read-aloud|googleweblight|mediapartners-google/i;
|
|
5
5
|
/**
|
|
6
6
|
* Service to detect bots and CDP (Chrome DevTools Protocol).
|
|
7
7
|
*
|
package/dist-esm/http/fetcher.js
CHANGED
|
@@ -117,7 +117,10 @@ export class Fetcher {
|
|
|
117
117
|
variables: opt.variables,
|
|
118
118
|
});
|
|
119
119
|
// Checking the query length, and not allowing to use GET if above 1900
|
|
120
|
-
if (opt.method === 'GET' && opt.query.length
|
|
120
|
+
if (opt.method === 'GET' && opt.query.length > 1900) {
|
|
121
|
+
opt.method = 'POST';
|
|
122
|
+
}
|
|
123
|
+
if (opt.method === 'GET') {
|
|
121
124
|
opt.searchParams = {
|
|
122
125
|
...opt.searchParams,
|
|
123
126
|
...payload,
|
package/package.json
CHANGED
package/src/bot.ts
CHANGED
|
@@ -26,7 +26,7 @@ export interface BotDetectionServiceCfg {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
const botRegex =
|
|
29
|
-
/bot|spider|crawl|headless|electron|phantom|slimer|proximic|cincraw|
|
|
29
|
+
/bot|spider|crawl|headless|electron|phantom|slimer|proximic|cincraw|slurp|MicrosoftPreview|ahrefs|preview|lighthouse|facebookexternal|pinterest|screaming|apis-google|duplexweb-google|feedfetcher-google|google-read-aloud|googleweblight|mediapartners-google/i
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
32
|
* Service to detect bots and CDP (Chrome DevTools Protocol).
|
package/src/http/fetcher.ts
CHANGED
|
@@ -194,7 +194,11 @@ export class Fetcher {
|
|
|
194
194
|
})
|
|
195
195
|
|
|
196
196
|
// Checking the query length, and not allowing to use GET if above 1900
|
|
197
|
-
if (opt.method === 'GET' && opt.query.length
|
|
197
|
+
if (opt.method === 'GET' && opt.query.length > 1900) {
|
|
198
|
+
opt.method = 'POST'
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
if (opt.method === 'GET') {
|
|
198
202
|
opt.searchParams = {
|
|
199
203
|
...opt.searchParams,
|
|
200
204
|
...payload,
|