is-antibot 1.3.5 → 1.3.6

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 +10 -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.3.5",
5
+ "version": "1.3.6",
6
6
  "exports": {
7
7
  ".": "./src/index.js"
8
8
  },
package/src/index.js CHANGED
@@ -237,9 +237,16 @@ const detect = ({ headers = {}, html = '', url = '' } = {}) => {
237
237
  return createResult(true, 'recaptcha')
238
238
  }
239
239
 
240
- // reCAPTCHA: Check for grecaptcha global object in html (primary JavaScript indicator)
241
- // Reference: https://github.com/scrapfly/Antibot-Detector/blob/main/detectors/captcha/detect-recaptcha.json
242
- if (htmlHas('grecaptcha')) {
240
+ // reCAPTCHA: Check for grecaptcha API usage in html (JavaScript indicator)
241
+ // Note: plain "grecaptcha" is too broad (e.g. ".grecaptcha-badge" CSS appears on normal YouTube pages)
242
+ if (
243
+ htmlHas(
244
+ '\\b(?:window\\.)?grecaptcha\\s*\\.(?:execute|render|ready|getResponse|enterprise)\\b',
245
+ true
246
+ ) ||
247
+ htmlHas('\\b(?:window\\.)?grecaptcha\\s*\\(', true) ||
248
+ htmlHas('\\b__grecaptcha_cfg\\b', true)
249
+ ) {
243
250
  return createResult(true, 'recaptcha')
244
251
  }
245
252