@unavatar/core 3.9.29 → 3.9.31
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
|
+
"version": "3.9.31",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": "./src/index.js",
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
"https-tls": "~1.0.24",
|
|
134
134
|
"ipaddr.js": "~2.3.0",
|
|
135
135
|
"is-absolute-url": "~3.0.3",
|
|
136
|
-
"is-antibot": "~1.
|
|
136
|
+
"is-antibot": "~1.6.1",
|
|
137
137
|
"is-email-like": "~1.0.0",
|
|
138
138
|
"lodash": "~4.18.1",
|
|
139
139
|
"ms": "~2.1.3",
|
|
@@ -40,7 +40,7 @@ module.exports = ({ PROXY_TIMEOUT, getHTML, onFetchHTML }) => {
|
|
|
40
40
|
* Extracts the avatar URL from the fetched HTML.
|
|
41
41
|
* - `string` — avatar URL found (success).
|
|
42
42
|
* - `undefined` — avatar not found (normal failure, no retry).
|
|
43
|
-
* @param {($: cheerio.CheerioAPI) => boolean} [opts.isBlocked]
|
|
43
|
+
* @param {(context: { $: cheerio.CheerioAPI, statusCode: number }) => boolean} [opts.isBlocked]
|
|
44
44
|
* Optional provider-specific blocked-page detector, checked after the
|
|
45
45
|
* default `is-antibot` check when getter returns empty/undefined.
|
|
46
46
|
* @param {() => object} [opts.htmlOpts] - Returns extra options merged into the fetch call.
|
|
@@ -111,13 +111,14 @@ module.exports = ({ PROXY_TIMEOUT, getHTML, onFetchHTML }) => {
|
|
|
111
111
|
})
|
|
112
112
|
|
|
113
113
|
const isRateLimited = statusCode === httpStatus.TOO_MANY_REQUESTS
|
|
114
|
-
const providerBlocked = isBlocked?.(
|
|
114
|
+
const providerBlocked = isBlocked?.({ $, statusCode })
|
|
115
115
|
|
|
116
116
|
const { detected: antibotDetected, provider: antibotProvider } =
|
|
117
117
|
isRateLimited || providerBlocked
|
|
118
118
|
? { detected: false, provider: null }
|
|
119
119
|
: isAntibot({
|
|
120
120
|
url: providerUrl,
|
|
121
|
+
statusCode,
|
|
121
122
|
headers: responseHeaders,
|
|
122
123
|
body: attempt.lastHtml
|
|
123
124
|
})
|