@unavatar/core 3.9.7 → 3.9.9

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/README.md CHANGED
@@ -1,4 +1,48 @@
1
- ![logo](https://unavatar.io/banner.png ':id=banner')
1
+ ![logo](https://unavatar.io/api/og?v=nm9v50tgm ':id=banner')
2
+
3
+ - [Table of Contents](#table-of-contents)
4
+ - [Introduction](#introduction)
5
+ - [Quick start](#quick-start)
6
+ - [Query parameters](#query-parameters)
7
+ - [TTL](#ttl)
8
+ - [Fallback](#fallback)
9
+ - [JSON](#json)
10
+ - [Pricing](#pricing)
11
+ - [Providers](#providers)
12
+ - [Apple Music](#apple-music)
13
+ - [Bluesky](#bluesky)
14
+ - [DeviantArt](#deviantart)
15
+ - [Dribbble](#dribbble)
16
+ - [DuckDuckGo](#duckduckgo)
17
+ - [GitHub](#github)
18
+ - [GitLab](#gitlab)
19
+ - [LinkedIn](#linkedin)
20
+ - [Google](#google)
21
+ - [Instagram](#instagram)
22
+ - [Ko-fi](#ko-fi)
23
+ - [Medium](#medium)
24
+ - [Microlink](#microlink)
25
+ - [Mastodon](#mastodon)
26
+ - [OnlyFans](#onlyfans)
27
+ - [OpenStreetMap](#openstreetmap)
28
+ - [Patreon](#patreon)
29
+ - [Printables](#printables)
30
+ - [Reddit](#reddit)
31
+ - [SoundCloud](#soundcloud)
32
+ - [Spotify](#spotify)
33
+ - [Substack](#substack)
34
+ - [Telegram](#telegram)
35
+ - [TikTok](#tiktok)
36
+ - [Twitch](#twitch)
37
+ - [Vimeo](#vimeo)
38
+ - [WhatsApp](#whatsapp)
39
+ - [YouTube](#youtube)
40
+ - [Response Format](#response-format)
41
+ - [Response Headers](#response-headers)
42
+
43
+ ---
44
+
45
+ ## Table of Contents
2
46
 
3
47
  - [Introduction](#introduction)
4
48
  - [Quick start](#quick-start)
@@ -47,7 +91,7 @@ Welcome to **unavatar.io**, the ultimate avatar service that offers everything y
47
91
 
48
92
  - **Versatile**: A wide range of platforms and services including [TikTok](https://unavatar.io/docs#tiktok), [Instagram](https://unavatar.io/docs#instagram), [YouTube](https://unavatar.io/docs#youtube), [X/Twitter](https://unavatar.io/docs#xtwitter), [Gravatar](https://unavatar.io/docs#gravatar), etc., meaning you can rule all of them just querying against unavatar.
49
93
 
50
- - **Speed**: Designed to be fast and efficient with a 97% cache hit rate, serving 24.3 TB of data across 522M requests.
94
+ - **Speed**: Designed to be fast and efficient with a 93% cache hit rate, serving 21.7 TB of data across 728M requests.
51
95
 
52
96
  - **Optimize**: All the images are not only compressed on-the-fly to reduce their size and save bandwith, but also optimized to maintain a high-quality ratio. They are ready for immediate use, enhancing the overall optimization of your website or application.
53
97
 
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.9",
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