@unavatar/core 3.25.7 → 3.26.0

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
@@ -65,13 +65,24 @@
65
65
  - [Response Format](#response-format)
66
66
  - [Response Headers](#response-headers)
67
67
  - [Response Errors](#response-errors)
68
+ - [Contact](#contact)
68
69
 
69
70
  ---
70
71
 
72
+ Last updated on April 29, 2026
73
+
71
74
  ## Introduction
72
75
 
73
76
  Welcome to **unavatar.io**, the ultimate avatar service that offers everything you need to easily retrieve user avatars:
74
77
 
78
+ - **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.
79
+
80
+ - **Speed**: Designed to be fast and efficient with a 91% cache hit rate, serving 12.5 TB of data across 382M requests.
81
+
82
+ - **Optimize**: All the images are not only compressed on-the-fly to reduce their size and save bandwidth, but also optimized to maintain a high-quality ratio. They are ready for immediate use, enhancing the overall optimization of your website or application.
83
+
84
+ - **Integration**: The service seamlessly incorporates into your current applications or websites with ease. We offer straightforward documentation and comprehensive support to ensure a quick and effortless onboarding experience.
85
+
75
86
  It's proudly powered by [microlink.io](https://microlink.io/), the headless browser API that handles all the heavy lifting behind the scenes to ensure your avatars are always ready.
76
87
 
77
88
  ## Quick start
@@ -112,11 +123,14 @@ Add this link on any page or surface displaying unavatar.io avatars:
112
123
 
113
124
  ```html
114
125
 
115
- <img src="https://unavatar.io/github/kikobeats" alt="Kiko" />
116
- <img src="https://unavatar.io/x/josebaseba" alt="Joseba" />
126
+ ![Kiko](https://unavatar.io/github/kikobeats)
127
+
128
+ ![Joseba](https://unavatar.io/x/josebaseba)
117
129
 
118
130
  <p class="attribution">
131
+
119
132
  [Avatars provided by Unavatar](https://unavatar.io)
133
+
120
134
  </p>
121
135
  ```
122
136
 
@@ -153,9 +167,13 @@ curl "https://unavatar.io/github/kikobeats" -H "x-api-key: YOUR_API_KEY"
153
167
 
154
168
  ```javascript
155
169
  await fetch('https://unavatar.io/github/kikobeats', {
170
+
156
171
  headers: {
172
+
157
173
  'x-api-key': 'YOUR_API_KEY'
174
+
158
175
  }
176
+
159
177
  })
160
178
  ```
161
179
 
@@ -163,8 +181,11 @@ await fetch('https://unavatar.io/github/kikobeats', {
163
181
  import requests
164
182
 
165
183
  response = requests.get(
184
+
166
185
  'https://unavatar.io/github/kikobeats',
186
+
167
187
  headers={'x-api-key': 'YOUR_API_KEY'}
188
+
168
189
  )
169
190
  ```
170
191
 
@@ -174,24 +195,33 @@ package main
174
195
  import "net/http"
175
196
 
176
197
  func main() {
198
+
177
199
  req, _ := http.NewRequest("GET", "https://unavatar.io/github/kikobeats", nil)
200
+
178
201
  req.Header.Set("x-api-key", "YOUR_API_KEY")
179
202
 
180
203
  resp, _ := http.DefaultClient.Do(req)
204
+
181
205
  defer resp.Body.Close()
206
+
182
207
  }
183
208
  ```
184
209
 
185
210
  ```ruby
186
211
  require 'net/http'
212
+
187
213
  require 'uri'
188
214
 
189
215
  uri = URI('https://unavatar.io/github/kikobeats')
216
+
190
217
  request = Net::HTTP::Get.new(uri)
218
+
191
219
  request['x-api-key'] = 'YOUR_API_KEY'
192
220
 
193
221
  response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
222
+
194
223
  http.request(request)
224
+
195
225
  end
196
226
  ```
197
227
 
@@ -199,11 +229,15 @@ end
199
229
  $ch = curl_init('https://unavatar.io/github/kikobeats');
200
230
 
201
231
  curl_setopt($ch, CURLOPT_HTTPHEADER, [
232
+
202
233
  'x-api-key: YOUR_API_KEY',
234
+
203
235
  ]);
236
+
204
237
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
205
238
 
206
239
  $response = curl_exec($ch);
240
+
207
241
  curl_close($ch);
208
242
  ```
209
243
 
@@ -221,7 +255,9 @@ Rate limit status can be verified using these response headers:
221
255
  $ curl -I https://unavatar.io/github/kikobeats
222
256
 
223
257
  x-rate-limit-limit: 25
258
+
224
259
  x-rate-limit-remaining: 24
260
+
225
261
  x-rate-limit-reset: 1744243200
226
262
  ```
227
263
 
@@ -251,7 +287,9 @@ The proxy tier used is returned in the `x-proxy-tier` response header, and the t
251
287
  $ curl -I -H "x-api-key: YOUR_API_KEY" https://unavatar.io/instagram/kikobeats
252
288
 
253
289
  x-pricing-tier: pro
290
+
254
291
  x-proxy-tier: origin
292
+
255
293
  x-unavatar-cost: 1
256
294
  ```
257
295
 
@@ -285,6 +323,7 @@ To check the cache status in real requests, inspect these response headers:
285
323
  $ curl -I -H "x-api-key: YOUR_API_KEY" "https://unavatar.io/github/kikobeats?ttl=1h"
286
324
 
287
325
  cache-control: public, max-age=3600
326
+
288
327
  x-cache-status: HIT
289
328
  ```
290
329
 
@@ -524,6 +563,10 @@ Available inputs:
524
563
  - SHA-256 hash, e.g., [unavatar.io/gravatar/b1f507c7a29adfa84eaa521036774b0577c58f23f2f3f42e068d6ac256cffae2](https://unavatar.io/gravatar/b1f507c7a29adfa84eaa521036774b0577c58f23f2f3f42e068d6ac256cffae2)
525
564
  - MD5 hash, e.g., [unavatar.io/gravatar/3f293df98a473eae038deabe430a1e30](https://unavatar.io/gravatar/3f293df98a473eae038deabe430a1e30)
526
565
 
566
+ When you pass an email address directly in the URL, it is visible in plain text — both in server logs and to any intermediary that inspects the request.
567
+
568
+ To avoid this, pass a pre-computed `MD5` or `SHA256` hash of the email instead. Unavatar detects the hash automatically and routes it to Gravatar, which natively supports both hash formats.
569
+
527
570
  ### Instagram
528
571
 
529
572
  Get any Instagram user's profile picture by their username. No authentication or API tokens needed — just pass the username.
@@ -780,11 +823,17 @@ These headers help you understand pricing, limits, and request diagnostics.
780
823
  $ curl -I -H "x-api-key: YOUR_API_KEY" https://unavatar.io/github/kikobeats
781
824
 
782
825
  x-pricing-tier: pro
826
+
783
827
  x-timestamp: 1744209600
828
+
784
829
  x-unavatar-cost: 1
830
+
785
831
  x-proxy-tier: origin
832
+
786
833
  x-rate-limit-limit: 50
834
+
787
835
  x-rate-limit-remaining: 49
836
+
788
837
  x-rate-limit-reset: 1744243200
789
838
  ```
790
839
 
@@ -825,4 +874,4 @@ Expected errors are known operational cases returned with stable codes.
825
874
 
826
875
  ## Contact
827
876
 
828
- If you have any suggestion or bug to report, please contact to ust mailing to [hello@unavatar.io](mailto:hello@unavatar.io).
877
+ If you have a suggestion or need to report a bug, contact us at <hello@unavatar.io>.
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.25.7",
5
+ "version": "3.26.0",
6
6
  "main": "src/index.js",
7
7
  "exports": {
8
8
  ".": "./src/index.js",
@@ -157,7 +157,7 @@
157
157
  "devDependencies": {
158
158
  "@commitlint/cli": "latest",
159
159
  "@commitlint/config-conventional": "latest",
160
- "ava": "latest",
160
+ "ava": "7",
161
161
  "c8": "latest",
162
162
  "cheerio": "latest",
163
163
  "ci-publish": "latest",
@@ -35,6 +35,7 @@ const providersBy = {
35
35
  'steam',
36
36
  'substack',
37
37
  'telegram',
38
+ 'thingiverse',
38
39
  'threads',
39
40
  'tiktok',
40
41
  'tumblr',
@@ -85,6 +86,7 @@ module.exports = ctx => {
85
86
  steam: require('./steam')(ctx),
86
87
  substack: require('./substack')(ctx),
87
88
  telegram: require('./telegram')(ctx),
89
+ thingiverse: require('./thingiverse')(ctx),
88
90
  threads: require('./threads')(ctx),
89
91
  tiktok: require('./tiktok')(ctx),
90
92
  tumblr: require('./tumblr')(ctx),
@@ -0,0 +1,16 @@
1
+ 'use strict'
2
+
3
+ const getProfileUrl = input => `https://www.thingiverse.com/${input}`
4
+
5
+ const getAvatarUrl = ({ getOgImage, $ }) =>
6
+ new URL(getOgImage($)).searchParams.get('url')
7
+
8
+ module.exports = ({ createHtmlProvider, getOgImage }) =>
9
+ createHtmlProvider({
10
+ name: 'thingiverse',
11
+ url: getProfileUrl,
12
+ getter: $ => getAvatarUrl({ getOgImage, $ })
13
+ })
14
+
15
+ module.exports.getAvatarUrl = getProfileUrl
16
+ module.exports.getAvatarUrlFromMarkup = getAvatarUrl