@unavatar/core 3.15.0 → 3.15.2

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
@@ -13,8 +13,10 @@
13
13
  - [JSON](#json)
14
14
  - [Providers](#providers)
15
15
  - [Apple Music](#apple-music)
16
+ - [Behance](#behance)
16
17
  - [Bluesky](#bluesky)
17
18
  - [DeviantArt](#deviantart)
19
+ - [Discord](#discord)
18
20
  - [Dribbble](#dribbble)
19
21
  - [DuckDuckGo](#duckduckgo)
20
22
  - [GitHub](#github)
@@ -29,13 +31,15 @@
29
31
  - [OnlyFans](#onlyfans)
30
32
  - [OpenStreetMap](#openstreetmap)
31
33
  - [Patreon](#patreon)
34
+ - [Pinterest](#pinterest)
32
35
  - [Printables](#printables)
33
36
  - [Reddit](#reddit)
37
+ - [Snapchat](#snapchat)
34
38
  - [SoundCloud](#soundcloud)
35
39
  - [Spotify](#spotify)
36
- - [Steam](#steam)
37
40
  - [Substack](#substack)
38
41
  - [Telegram](#telegram)
42
+ - [Threads](#threads)
39
43
  - [TikTok](#tiktok)
40
44
  - [Twitch](#twitch)
41
45
  - [Vimeo](#vimeo)
@@ -76,11 +80,11 @@ The anonymous requests works without authentication. They are limited to 25 requ
76
80
 
77
81
  For [PRO](https://unavatar.io/checkout) users, the requests must include the API key as the `x-api-key` request header:
78
82
 
79
- ``` bash
83
+ ```bash
80
84
  curl -H "x-api-key: YOUR_API_KEY" "https://[unavatar.io/github/kikobeats"](https://unavatar.io/github/kikobeats")
81
85
  ```
82
86
 
83
- ``` javascript
87
+ ```javascript
84
88
  await fetch('https://[unavatar.io/github/kikobeats',](https://unavatar.io/github/kikobeats',) {
85
89
  headers: {
86
90
  'x-api-key': process.env.UNAVATAR_API_KEY
@@ -88,7 +92,7 @@ await fetch('https://[unavatar.io/github/kikobeats',](https://unavatar.io/github
88
92
  })
89
93
  ```
90
94
 
91
- ``` python
95
+ ```python
92
96
  import os
93
97
  import requests
94
98
 
@@ -98,7 +102,7 @@ response = requests.get(
98
102
  )
99
103
  ```
100
104
 
101
- ``` golang
105
+ ```golang
102
106
  package main
103
107
 
104
108
  import (
@@ -115,7 +119,7 @@ func main() {
115
119
  }
116
120
  ```
117
121
 
118
- ``` ruby
122
+ ```ruby
119
123
  require 'net/http'
120
124
  require 'uri'
121
125
 
@@ -128,7 +132,7 @@ response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
128
132
  end
129
133
  ```
130
134
 
131
- ``` php
135
+ ```php
132
136
  $ch = curl_init('https://[unavatar.io/github/kikobeats');](https://unavatar.io/github/kikobeats');)
133
137
 
134
138
  curl_setopt($ch, CURLOPT_HTTPHEADER, [
@@ -150,7 +154,7 @@ Rate limit status can be verified using these response headers:
150
154
  | `x-rate-limit-remaining` | Requests remaining in the current window |
151
155
  | `x-rate-limit-reset` | UTC epoch seconds when the current window resets |
152
156
 
153
- ``` bash
157
+ ```bash
154
158
  $ curl -I https://[unavatar.io/github/kikobeats](https://unavatar.io/github/kikobeats)
155
159
 
156
160
  x-rate-limit-limit: 25
@@ -180,7 +184,7 @@ Every request has a cost in tokens (**\$0.005 per token**) based on the proxy ti
180
184
 
181
185
  The proxy tier used is returned in the `x-proxy-tier` response header, and the total cost in the `x-unavatar-cost` header.
182
186
 
183
- ``` bash
187
+ ```bash
184
188
  $ curl -I -H "x-api-key: YOUR_API_KEY" https://[unavatar.io/instagram/kikobeats](https://unavatar.io/instagram/kikobeats)
185
189
 
186
190
  x-pricing-tier: pro
@@ -214,7 +218,7 @@ To check the cache status in real requests, inspect these response headers:
214
218
  | `x-cache-status` | `HIT` means served from cache. `MISS` means fetched/refreshed from upstream. |
215
219
  | `cache-control` | Shows cache policy and effective TTL (for example `public, max-age=3600` for `ttl=1h`). |
216
220
 
217
- ``` bash
221
+ ```bash
218
222
  $ curl -I -H "x-api-key: YOUR_API_KEY" "https://[unavatar.io/github/kikobeats?ttl=1h"](https://unavatar.io/github/kikobeats?ttl=1h")
219
223
 
220
224
  cache-control: public, max-age=3600
@@ -299,6 +303,14 @@ Available URI format inputs:
299
303
  - by song name: [unavatar.io/apple-music/song:harder%20better%20faster%20stronger](https://unavatar.io/apple-music/song:harder%20better%20faster%20stronger)
300
304
  - by song ID: [unavatar.io/apple-music/song:697195787](https://unavatar.io/apple-music/song:697195787)
301
305
 
306
+ ### Behance
307
+
308
+ Get any Behance user's profile picture by their username.
309
+
310
+ Available inputs:
311
+
312
+ - Username, e.g., [unavatar.io/behance/vitormatosinhos](https://unavatar.io/behance/vitormatosinhos)
313
+
302
314
  ### Bluesky
303
315
 
304
316
  Get any Bluesky user's profile picture by their handle. Domain-style handles are supported.
@@ -314,7 +326,16 @@ Get any DeviantArt user's profile picture by their username.
314
326
 
315
327
  Available inputs:
316
328
 
317
- - slug, e.g., [unavatar.io/deviantart/spyed](https://unavatar.io/deviantart/spyed)
329
+ - Username, e.g., [unavatar.io/deviantart/spyed](https://unavatar.io/deviantart/spyed)
330
+
331
+ ### Discord
332
+
333
+ Get a Discord server's icon by server name or server ID.
334
+
335
+ Available inputs:
336
+
337
+ - Server name, e.g., [unavatar.io/discord/lilnasx](https://unavatar.io/discord/lilnasx)
338
+ - Server ID, e.g., [unavatar.io/discord/uW6Hyf3E9r](https://unavatar.io/discord/uW6Hyf3E9r)
318
339
 
319
340
  ### Dribbble
320
341
 
@@ -322,7 +343,7 @@ Get any Dribbble designer's profile picture by their username.
322
343
 
323
344
  Available inputs:
324
345
 
325
- - slug, e.g., [unavatar.io/dribbble/omidnikrah](https://unavatar.io/dribbble/omidnikrah)
346
+ - Username, e.g., [unavatar.io/dribbble/omidnikrah](https://unavatar.io/dribbble/omidnikrah)
326
347
 
327
348
  ### DuckDuckGo
328
349
 
@@ -352,7 +373,7 @@ Available inputs:
352
373
 
353
374
  ### LinkedIn
354
375
 
355
- Get any LinkedIn user or company profile picture by their public profile slug.
376
+ Get any LinkedIn user or company profile picture by username or company slug.
356
377
 
357
378
  e.g., [unavatar.io/linkedin/user:wesbos](https://unavatar.io/linkedin/user:wesbos)
358
379
 
@@ -385,15 +406,15 @@ Get any Instagram user's profile picture by their username. No authentication or
385
406
 
386
407
  Available inputs:
387
408
 
388
- - slug, e.g., [unavatar.io/instagram/willsmith](https://unavatar.io/instagram/willsmith)
409
+ - Username, e.g., [unavatar.io/instagram/willsmith](https://unavatar.io/instagram/willsmith)
389
410
 
390
411
  ### Ko-fi
391
412
 
392
- Get any Ko-fi page's profile picture by their public creator page slug.
413
+ Get any Ko-fi page's profile picture by the creator username.
393
414
 
394
415
  Available inputs:
395
416
 
396
- - Page slug, e.g., [unavatar.io/ko-fi/geekshock](https://unavatar.io/ko-fi/geekshock)
417
+ - Creator username, e.g., [unavatar.io/ko-fi/geekshock](https://unavatar.io/ko-fi/geekshock)
397
418
 
398
419
  ### Medium
399
420
 
@@ -401,7 +422,7 @@ Get any Medium author's profile picture by their username.
401
422
 
402
423
  Available inputs:
403
424
 
404
- - slug, e.g., [unavatar.io/medium/juancalmaraz](https://unavatar.io/medium/juancalmaraz)
425
+ - Username, e.g., [unavatar.io/medium/juancalmaraz](https://unavatar.io/medium/juancalmaraz)
405
426
 
406
427
  ### Microlink
407
428
 
@@ -425,7 +446,7 @@ Get any OnlyFans creator's profile picture by their username.
425
446
 
426
447
  Available inputs:
427
448
 
428
- - slug, e.g., [unavatar.io/onlyfans/amandaribas](https://unavatar.io/onlyfans/amandaribas)
449
+ - Username, e.g., [unavatar.io/onlyfans/amandaribas](https://unavatar.io/onlyfans/amandaribas)
429
450
 
430
451
  ### OpenStreetMap
431
452
 
@@ -434,7 +455,7 @@ Get any OpenStreetMap contributor's profile picture. Accepts either a numeric us
434
455
  Available inputs:
435
456
 
436
457
  - Numeric user ID, e.g., [unavatar.io/openstreetmap/98672](https://unavatar.io/openstreetmap/98672)
437
- - slug, e.g., [unavatar.io/openstreetmap/Terence%20Eden](https://unavatar.io/openstreetmap/Terence%20Eden)
458
+ - Username, e.g., [unavatar.io/openstreetmap/Terence%20Eden](https://unavatar.io/openstreetmap/Terence%20Eden)
438
459
 
439
460
  ### Patreon
440
461
 
@@ -442,7 +463,15 @@ Get any Patreon creator's profile picture by their username.
442
463
 
443
464
  Available inputs:
444
465
 
445
- - slug, e.g., [unavatar.io/patreon/gametestro](https://unavatar.io/patreon/gametestro)
466
+ - Username, e.g., [unavatar.io/patreon/gametestro](https://unavatar.io/patreon/gametestro)
467
+
468
+ ### Pinterest
469
+
470
+ Get any Pinterest user's profile picture by their username.
471
+
472
+ Available inputs:
473
+
474
+ - Username, e.g., [unavatar.io/pinterest/ohjoy](https://unavatar.io/pinterest/ohjoy)
446
475
 
447
476
  ### Printables
448
477
 
@@ -450,7 +479,7 @@ Get any Printables user's profile picture by their username.
450
479
 
451
480
  Available inputs:
452
481
 
453
- - slug, e.g., [unavatar.io/printables/DukeDoks](https://unavatar.io/printables/DukeDoks)
482
+ - Username, e.g., [unavatar.io/printables/DukeDoks](https://unavatar.io/printables/DukeDoks)
454
483
 
455
484
  ### Reddit
456
485
 
@@ -458,7 +487,15 @@ Get any Reddit user's avatar by their username.
458
487
 
459
488
  Available inputs:
460
489
 
461
- - slug, e.g., [unavatar.io/reddit/kikobeats](https://unavatar.io/reddit/kikobeats)
490
+ - Username, e.g., [unavatar.io/reddit/kikobeats](https://unavatar.io/reddit/kikobeats)
491
+
492
+ ### Snapchat
493
+
494
+ Get any Snapchat user's profile picture by their username.
495
+
496
+ Available inputs:
497
+
498
+ - Username, e.g., [unavatar.io/snapchat/teddysdaytoday](https://unavatar.io/snapchat/teddysdaytoday)
462
499
 
463
500
  ### SoundCloud
464
501
 
@@ -466,7 +503,7 @@ Get any SoundCloud artist's profile picture by their username.
466
503
 
467
504
  Available inputs:
468
505
 
469
- - slug, e.g., [unavatar.io/soundcloud/gorillaz](https://unavatar.io/soundcloud/gorillaz)
506
+ - Username, e.g., [unavatar.io/soundcloud/gorillaz](https://unavatar.io/soundcloud/gorillaz)
470
507
 
471
508
  ### Spotify
472
509
 
@@ -488,22 +525,6 @@ Available URI format inputs:
488
525
  - `track`: [unavatar.io/spotify/track:4OROzZUy6gOWN4UGQVaZMF](https://unavatar.io/spotify/track:4OROzZUy6gOWN4UGQVaZMF)
489
526
  - `user` (default): [unavatar.io/spotify/user:kikobeats](https://unavatar.io/spotify/user:kikobeats)
490
527
 
491
- ### Steam
492
-
493
- Get any Steam Community avatar by vanity ID, numeric profile ID, or group slug.
494
-
495
- e.g., [unavatar.io/steam/Kikobeats](https://unavatar.io/steam/Kikobeats)
496
-
497
- The input supports a URI format `type:id`.
498
-
499
- When no type is provided, it defaults to `id` (vanity profile URL).
500
-
501
- Available URI format inputs:
502
-
503
- - `id` (default): [unavatar.io/steam/Kikobeats](https://unavatar.io/steam/Kikobeats)
504
- - `profiles`: [unavatar.io/steam/profiles:76561197976050016](https://unavatar.io/steam/profiles:76561197976050016)
505
- - `groups`: [unavatar.io/steam/groups:microlink](https://unavatar.io/steam/groups:microlink)
506
-
507
528
  ### Substack
508
529
 
509
530
  Get any Substack author's profile picture by their publication username.
@@ -518,7 +539,15 @@ Get any Telegram user's profile picture by their username.
518
539
 
519
540
  Available inputs:
520
541
 
521
- - slug, e.g., [unavatar.io/telegram/drsdavidsoft](https://unavatar.io/telegram/drsdavidsoft)
542
+ - Username, e.g., [unavatar.io/telegram/drsdavidsoft](https://unavatar.io/telegram/drsdavidsoft)
543
+
544
+ ### Threads
545
+
546
+ Get any Threads user's profile picture by their username.
547
+
548
+ Available inputs:
549
+
550
+ - Username, e.g., [unavatar.io/threads/zuck](https://unavatar.io/threads/zuck)
522
551
 
523
552
  ### TikTok
524
553
 
@@ -526,7 +555,7 @@ Get any TikTok user's profile picture by their username. No authentication or AP
526
555
 
527
556
  Available inputs:
528
557
 
529
- - slug, e.g., [unavatar.io/tiktok/carlosazaustre](https://unavatar.io/tiktok/carlosazaustre)
558
+ - Username, e.g., [unavatar.io/tiktok/carlosazaustre](https://unavatar.io/tiktok/carlosazaustre)
530
559
 
531
560
  ### Twitch
532
561
 
@@ -534,7 +563,7 @@ Get any Twitch streamer's profile picture by their username.
534
563
 
535
564
  Available inputs:
536
565
 
537
- - slug, e.g., [unavatar.io/twitch/midudev](https://unavatar.io/twitch/midudev)
566
+ - Username, e.g., [unavatar.io/twitch/midudev](https://unavatar.io/twitch/midudev)
538
567
 
539
568
  ### Vimeo
540
569
 
@@ -542,21 +571,18 @@ Get any Vimeo user's profile picture by their username.
542
571
 
543
572
  Available inputs:
544
573
 
545
- - slug, e.g., [unavatar.io/vimeo/ladieswithlenses](https://unavatar.io/vimeo/ladieswithlenses)
574
+ - Username, e.g., [unavatar.io/vimeo/ladieswithlenses](https://unavatar.io/vimeo/ladieswithlenses)
546
575
 
547
576
  ### WhatsApp
548
577
 
549
- Get the profile picture for a WhatsApp phone number, channel, chat, or group.
578
+ Get the profile picture for a WhatsApp channel or chat by ID.
550
579
 
551
- e.g., [unavatar.io/whatsapp/phone:34660021551](https://unavatar.io/whatsapp/phone:34660021551)
580
+ e.g., [unavatar.io/whatsapp/channel:0029VaARuQ7KwqSXh9fiMc0m](https://unavatar.io/whatsapp/channel:0029VaARuQ7KwqSXh9fiMc0m)
552
581
 
553
582
  The input supports a URI format `type:id`.
554
583
 
555
- When no type is provided, it defaults to `phone`.
556
-
557
584
  Available URI format inputs:
558
585
 
559
- - `phone` (default): [unavatar.io/whatsapp/phone:34660021551](https://unavatar.io/whatsapp/phone:34660021551)
560
586
  - `channel`: [unavatar.io/whatsapp/channel:0029VaARuQ7KwqSXh9fiMc0m](https://unavatar.io/whatsapp/channel:0029VaARuQ7KwqSXh9fiMc0m)
561
587
  - `chat`: [unavatar.io/whatsapp/chat:D2FFycjQXrEIKG8qQjbwZz](https://unavatar.io/whatsapp/chat:D2FFycjQXrEIKG8qQjbwZz)
562
588
 
@@ -564,7 +590,7 @@ Get any X (formerly Twitter) user's profile picture by their username.
564
590
 
565
591
  Available inputs:
566
592
 
567
- - slug, e.g., [unavatar.io/x/kikobeats](https://unavatar.io/x/kikobeats)
593
+ - Username, e.g., [unavatar.io/x/kikobeats](https://unavatar.io/x/kikobeats)
568
594
 
569
595
  ### YouTube
570
596
 
@@ -578,7 +604,7 @@ If the input starts with `UC` and has 24 characters, it is treated as a channel
578
604
 
579
605
  Available inputs:
580
606
 
581
- - `username`: [unavatar.io/youtube/casey](https://unavatar.io/youtube/casey) or [unavatar.io/youtube/@casey](https://unavatar.io/youtube/@casey)
607
+ - `username`: [unavatar.io/youtube/casey](https://unavatar.io/youtube/casey)
582
608
  - `channel`: [unavatar.io/youtube/UC_x5XG1OV2P6uZZ5FSM9Ttw](https://unavatar.io/youtube/UC_x5XG1OV2P6uZZ5FSM9Ttw)
583
609
 
584
610
  ## Response Format
@@ -613,7 +639,7 @@ These headers help you understand pricing, limits, and request diagnostics.
613
639
  | `x-rate-limit-reset` | UTC epoch seconds when window resets (free tier only) |
614
640
  | `retry-after` | Seconds until rate limit resets (only on 429 responses) |
615
641
 
616
- ``` bash
642
+ ```bash
617
643
  $ curl -I -H "x-api-key: YOUR_API_KEY" https://[unavatar.io/github/kikobeats](https://unavatar.io/github/kikobeats)
618
644
 
619
645
  x-pricing-tier: pro
@@ -660,4 +686,4 @@ Expected errors are known operational cases returned with stable codes.
660
686
 
661
687
  ## Contact
662
688
 
663
- If you have any suggestion or bug to report, please contact to ust mailing to [hello@unavatar.io](mailto:hello@unavatar.io).
689
+ If you have any suggestion or bug to report, please contact to ust mailing to [hello@unavatar.io](mailto: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.15.0",
5
+ "version": "3.15.2",
6
6
  "main": "src/index.js",
7
7
  "exports": {
8
8
  ".": "./src/index.js",
@@ -1,5 +1,7 @@
1
1
  'use strict'
2
2
 
3
+ const STEAM_DEFAULT_OG_IMAGE = 'steam_share_image.jpg'
4
+
3
5
  const getAvatarUrl = input => {
4
6
  const [first, second] = input.split(':')
5
7
  const type = second ? first : 'id'
@@ -23,7 +25,12 @@ module.exports = ({ createHtmlProvider, getOgImage }) =>
23
25
  createHtmlProvider({
24
26
  name: 'steam',
25
27
  url: getAvatarUrl,
26
- getter: getOgImage
28
+ getter: $ => {
29
+ const ogImage = getOgImage($)
30
+ const hasDefaultOgImage = ogImage?.includes(STEAM_DEFAULT_OG_IMAGE)
31
+ if (ogImage && !hasDefaultOgImage) return ogImage
32
+ return $('source[srcset]').attr('srcset')
33
+ }
27
34
  })
28
35
 
29
36
  module.exports.getAvatarUrl = getAvatarUrl