@unavatar/core 3.9.5 → 3.9.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.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@unavatar/core",
3
3
  "description": "Get unified user avatar from social networks, including Instagram, SoundCloud, Telegram, Twitter, YouTube & more.",
4
4
  "homepage": "https://unavatar.io",
5
- "version": "3.9.5",
5
+ "version": "3.9.6",
6
6
  "main": "src/index.js",
7
7
  "exports": {
8
8
  ".": "./src/index.js",
@@ -110,14 +110,20 @@ module.exports = ({ PROXY_TIMEOUT, getHTML, onFetchHTML }) => {
110
110
  }
111
111
  })
112
112
 
113
- const { detected: antibotDetected, provider: antibotProvider } =
114
- isAntibot({
115
- url: providerUrl,
116
- headers: responseHeaders,
117
- body: attempt.lastHtml
118
- })
113
+ const isRateLimited = statusCode === httpStatus.TOO_MANY_REQUESTS
119
114
 
120
- if (antibotDetected || isBlocked?.($) === true) error.blocked = true
115
+ const { detected: antibotDetected, provider: antibotProvider } =
116
+ isRateLimited
117
+ ? { detected: false, provider: null }
118
+ : isAntibot({
119
+ url: providerUrl,
120
+ headers: responseHeaders,
121
+ body: attempt.lastHtml
122
+ })
123
+
124
+ if (isRateLimited || antibotDetected || isBlocked?.($) === true) {
125
+ error.blocked = true
126
+ }
121
127
 
122
128
  log.error({
123
129
  statusCode,