is-antibot 1.4.0 → 1.4.1

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +9 -3
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "is-antibot",
3
3
  "description": "Identify if a response is an antibot challenge from CloudFlare, Akamai, DataDome, Vercel, PerimeterX, Shape Security, and more, including CAPTCHA providers like reCAPTCHA and hCaptcha.",
4
4
  "homepage": "https://github.com/microlinkhq/is-antibot",
5
- "version": "1.4.0",
5
+ "version": "1.4.1",
6
6
  "exports": {
7
7
  ".": "./src/index.js"
8
8
  },
package/src/index.js CHANGED
@@ -125,9 +125,15 @@ const detect = ({ headers = {}, html = '', url = '' } = {}) => {
125
125
  return byHeaders('datadome')
126
126
  }
127
127
 
128
- // DataDome: Check for x-datadome or x-datadome-cid header presence
129
- // Reference: https://github.com/scrapfly/Antibot-Detector/blob/main/detectors/antibot/detect-datadome.json
130
- if (hasAnyHeader(['x-datadome', 'x-datadome-cid'])) {
128
+ // DataDome: x-datadome header presence.
129
+ // Note: `x-datadome: protected` can appear on successful responses.
130
+ const xDatadome = getHeader('x-datadome')
131
+ if (xDatadome && String(xDatadome).toLowerCase() !== 'protected') {
132
+ return byHeaders('datadome')
133
+ }
134
+
135
+ // DataDome: x-datadome-cid header presence
136
+ if (hasAnyHeader(['x-datadome-cid'])) {
131
137
  return byHeaders('datadome')
132
138
  }
133
139