@unavatar/core 3.9.7 → 3.9.8

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.7",
5
+ "version": "3.9.8",
6
6
  "main": "src/index.js",
7
7
  "exports": {
8
8
  ".": "./src/index.js",
@@ -4,5 +4,6 @@ module.exports = ({ createHtmlProvider, getOgImage }) =>
4
4
  createHtmlProvider({
5
5
  name: 'instagram',
6
6
  url: input => `https://www.instagram.com/${input}`,
7
- getter: getOgImage
7
+ getter: getOgImage,
8
+ isBlocked: $ => $('title').text() === 'Login \u2022 Instagram'
8
9
  })
@@ -111,9 +111,10 @@ module.exports = ({ PROXY_TIMEOUT, getHTML, onFetchHTML }) => {
111
111
  })
112
112
 
113
113
  const isRateLimited = statusCode === httpStatus.TOO_MANY_REQUESTS
114
+ const providerBlocked = isBlocked?.($)
114
115
 
115
116
  const { detected: antibotDetected, provider: antibotProvider } =
116
- isRateLimited
117
+ isRateLimited || providerBlocked
117
118
  ? { detected: false, provider: null }
118
119
  : isAntibot({
119
120
  url: providerUrl,
@@ -121,7 +122,7 @@ module.exports = ({ PROXY_TIMEOUT, getHTML, onFetchHTML }) => {
121
122
  body: attempt.lastHtml
122
123
  })
123
124
 
124
- if (isRateLimited || antibotDetected || isBlocked?.($) === true) {
125
+ if (isRateLimited || providerBlocked || antibotDetected) {
125
126
  error.blocked = true
126
127
  }
127
128