@unavatar/core 3.25.2 → 3.25.4
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 +131 -105
- package/bin/index.js +1 -1
- package/package.json +1 -1
- package/src/providers/apple-store.js +26 -45
package/README.md
CHANGED
|
@@ -13,23 +13,29 @@
|
|
|
13
13
|
- [JSON](#json)
|
|
14
14
|
- [Providers](#providers)
|
|
15
15
|
- [Apple Music](#apple-music)
|
|
16
|
+
- [Apple Store](#apple-store)
|
|
16
17
|
- [Behance](#behance)
|
|
17
18
|
- [Bluesky](#bluesky)
|
|
19
|
+
- [Buy Me a Coffee](#buy-me-a-coffee)
|
|
18
20
|
- [DeviantArt](#deviantart)
|
|
19
21
|
- [Discord](#discord)
|
|
22
|
+
- [Domain](#domain)
|
|
20
23
|
- [Dribbble](#dribbble)
|
|
21
24
|
- [DuckDuckGo](#duckduckgo)
|
|
25
|
+
- [Email](#email)
|
|
22
26
|
- [Facebook](#facebook)
|
|
27
|
+
- [Flickr](#flickr)
|
|
23
28
|
- [GitHub](#github)
|
|
24
29
|
- [GitLab](#gitlab)
|
|
25
|
-
- [LinkedIn](#linkedin)
|
|
26
30
|
- [Google](#google)
|
|
31
|
+
- [Google Play](#google-play)
|
|
27
32
|
- [Gravatar](#gravatar)
|
|
28
33
|
- [Instagram](#instagram)
|
|
29
34
|
- [Ko-fi](#ko-fi)
|
|
35
|
+
- [LinkedIn](#linkedin)
|
|
36
|
+
- [Mastodon](#mastodon)
|
|
30
37
|
- [Medium](#medium)
|
|
31
38
|
- [Microlink](#microlink)
|
|
32
|
-
- [Mastodon](#mastodon)
|
|
33
39
|
- [OnlyFans](#onlyfans)
|
|
34
40
|
- [OpenStreetMap](#openstreetmap)
|
|
35
41
|
- [Patreon](#patreon)
|
|
@@ -40,6 +46,7 @@
|
|
|
40
46
|
- [Snapchat](#snapchat)
|
|
41
47
|
- [SoundCloud](#soundcloud)
|
|
42
48
|
- [Spotify](#spotify)
|
|
49
|
+
- [Stack Overflow](#stack-overflow)
|
|
43
50
|
- [Steam](#steam)
|
|
44
51
|
- [Substack](#substack)
|
|
45
52
|
- [Telegram](#telegram)
|
|
@@ -70,12 +77,15 @@ The service is exposed in **unavatar.io** via provider endpoints:
|
|
|
70
77
|
|
|
71
78
|
- an **email (auto-detect)**: [unavatar.io/hello@microlink.io](https://unavatar.io/hello@microlink.io) — tries Gravatar, then GitHub
|
|
72
79
|
- an **email** via Gravatar: [unavatar.io/gravatar/hello@microlink.io](https://unavatar.io/gravatar/hello@microlink.io)
|
|
80
|
+
- a **Gravatar SHA-256** (same email, pre-hashed): [unavatar.io/gravatar/b1f507c7a29adfa84eaa521036774b0577c58f23f2f3f42e068d6ac256cffae2](https://unavatar.io/gravatar/b1f507c7a29adfa84eaa521036774b0577c58f23f2f3f42e068d6ac256cffae2)
|
|
73
81
|
- an **email** via GitHub: [unavatar.io/github/sindresorhus@gmail.com](https://unavatar.io/github/sindresorhus@gmail.com)
|
|
74
82
|
- an **username**: [unavatar.io/github/kikobeats](https://unavatar.io/github/kikobeats)
|
|
75
83
|
- a **domain**: [unavatar.io/google/reddit.com](https://unavatar.io/google/reddit.com)
|
|
76
84
|
|
|
77
85
|
Use `/:provider/:key` for provider-specific lookups, or pass an email as the only path segment for automatic resolution. You can read more in [Email avatars](https://unavatar.io/email) and [providers](https://unavatar.io/docs#providers).
|
|
78
86
|
|
|
87
|
+
For **Gravatar**, `key` can be a plain email or a precomputed identifier: emails are trimmed, lowercased, and hashed with **SHA-256** before calling Gravatar. Values that already look like a **64-character hex SHA-256** or **32-character hex MD5** are sent as-is (hex is normalized to lowercase).
|
|
88
|
+
|
|
79
89
|
## Authentication
|
|
80
90
|
|
|
81
91
|
Anonymous requests work without authentication. They are limited to 25 requests/day per IP address.
|
|
@@ -283,13 +293,11 @@ e.g., [unavatar.io/github/kikobeats?json](https://unavatar.io/github/kikobeats?j
|
|
|
283
293
|
|
|
284
294
|
Get artwork for any Apple Music artist, album, or song. Search by name or look up directly by numeric Apple Music ID.
|
|
285
295
|
|
|
286
|
-
e.g., [unavatar.io/apple-music/artist:daft%20punk](https://unavatar.io/apple-music/artist:daft%20punk)
|
|
287
|
-
|
|
288
296
|
The endpoint supports explicit type as part of the input.
|
|
289
297
|
|
|
290
298
|
If explicit type is not provided, it searches `artist` and `song` (in that order).
|
|
291
299
|
|
|
292
|
-
Available
|
|
300
|
+
Available inputs:
|
|
293
301
|
|
|
294
302
|
- artist
|
|
295
303
|
- by artist name: [unavatar.io/apple-music/artist:daft%20punk](https://unavatar.io/apple-music/artist:daft%20punk)
|
|
@@ -301,13 +309,25 @@ Available URI format inputs:
|
|
|
301
309
|
- by song name: [unavatar.io/apple-music/song:harder%20better%20faster%20stronger](https://unavatar.io/apple-music/song:harder%20better%20faster%20stronger)
|
|
302
310
|
- by song ID: [unavatar.io/apple-music/song:697195787](https://unavatar.io/apple-music/song:697195787)
|
|
303
311
|
|
|
304
|
-
###
|
|
312
|
+
### Apple Store
|
|
305
313
|
|
|
306
|
-
Get any
|
|
314
|
+
Get the icon for any iOS or macOS app on the App Store by numeric Apple ID.
|
|
315
|
+
|
|
316
|
+
The endpoint supports explicit type as part of the input.
|
|
317
|
+
|
|
318
|
+
If explicit type is not provided, it defaults to `id`.
|
|
307
319
|
|
|
308
320
|
Available inputs:
|
|
309
321
|
|
|
310
|
-
-
|
|
322
|
+
- `id` (default): [unavatar.io/apple-store/id:529479190](https://unavatar.io/apple-store/id:529479190)
|
|
323
|
+
- `id`: [unavatar.io/apple-store/id:6474323148@es](https://unavatar.io/apple-store/id:6474323148@es)
|
|
324
|
+
- `name`: [unavatar.io/apple-store/name:pokemon%20go](https://unavatar.io/apple-store/name:pokemon%20go)
|
|
325
|
+
|
|
326
|
+
### Behance
|
|
327
|
+
|
|
328
|
+
Get any Behance user's profile picture by their username.
|
|
329
|
+
|
|
330
|
+
e.g., [unavatar.io/behance/vitormatosinhos](https://unavatar.io/behance/vitormatosinhos)
|
|
311
331
|
|
|
312
332
|
### Bluesky
|
|
313
333
|
|
|
@@ -318,13 +338,17 @@ Available inputs:
|
|
|
318
338
|
- User handle, e.g., [unavatar.io/bluesky/pfrazee.com](https://unavatar.io/bluesky/pfrazee.com)
|
|
319
339
|
- Domain handle, e.g., [unavatar.io/bluesky/bsky.app](https://unavatar.io/bluesky/bsky.app)
|
|
320
340
|
|
|
341
|
+
### Buy Me a Coffee
|
|
342
|
+
|
|
343
|
+
Get any Buy Me a Coffee creator's profile picture by their username.
|
|
344
|
+
|
|
345
|
+
e.g., [unavatar.io/buymeacoffee/mikebarnesdrums](https://unavatar.io/buymeacoffee/mikebarnesdrums)
|
|
346
|
+
|
|
321
347
|
### DeviantArt
|
|
322
348
|
|
|
323
349
|
Get any DeviantArt user's profile picture by their username.
|
|
324
350
|
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
- Username, e.g., [unavatar.io/deviantart/spyed](https://unavatar.io/deviantart/spyed)
|
|
351
|
+
e.g., [unavatar.io/deviantart/spyed](https://unavatar.io/deviantart/spyed)
|
|
328
352
|
|
|
329
353
|
### Discord
|
|
330
354
|
|
|
@@ -335,21 +359,45 @@ Available inputs:
|
|
|
335
359
|
- Server name, e.g., [unavatar.io/discord/lilnasx](https://unavatar.io/discord/lilnasx)
|
|
336
360
|
- Server ID, e.g., [unavatar.io/discord/uW6Hyf3E9r](https://unavatar.io/discord/uW6Hyf3E9r)
|
|
337
361
|
|
|
362
|
+
### Domain
|
|
363
|
+
|
|
364
|
+
Retrieve logos and favicons from any hostname with a single URL. Domain-shaped paths try DuckDuckGo, Google, Microlink in order until one returns an image, same as the explicit `/domain/:key` route.
|
|
365
|
+
|
|
366
|
+
e.g., [unavatar.io/domain/microlink.io](https://unavatar.io/domain/microlink.io)
|
|
367
|
+
|
|
338
368
|
### Dribbble
|
|
339
369
|
|
|
340
370
|
Get any Dribbble designer's profile picture by their username.
|
|
341
371
|
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
- Username, e.g., [unavatar.io/dribbble/omidnikrah](https://unavatar.io/dribbble/omidnikrah)
|
|
372
|
+
e.g., [unavatar.io/dribbble/omidnikrah](https://unavatar.io/dribbble/omidnikrah)
|
|
345
373
|
|
|
346
374
|
### DuckDuckGo
|
|
347
375
|
|
|
348
376
|
Get the favicon or logo for any domain via DuckDuckGo's icon service. Useful as a fallback when a domain doesn't expose its favicon directly.
|
|
349
377
|
|
|
350
|
-
|
|
378
|
+
e.g., [unavatar.io/duckduckgo/microsoft.com](https://unavatar.io/duckduckgo/microsoft.com)
|
|
379
|
+
|
|
380
|
+
### Email
|
|
381
|
+
|
|
382
|
+
Resolve user avatars from an email address with a single URL. The `/email/:key` route uses the same provider chain as a bare `/user@domain` path: the service tries Gravatar, GitHub in order until one returns an image. No API keys and no SDK are required.
|
|
383
|
+
|
|
384
|
+
When the path looks like an email, unavatar walks that chain until a provider succeeds. You can also skip the chain and call a named email provider directly when you know where the avatar should come from.
|
|
351
385
|
|
|
352
|
-
|
|
386
|
+
Automatic resolution
|
|
387
|
+
|
|
388
|
+
Pass the address as the only path segment, or prefix it with `email/`. The API auto-detects email-shaped inputs and runs the same chain (Gravatar, GitHub).
|
|
389
|
+
|
|
390
|
+
- Typed route `unavatar.io/email/{email}`: [unavatar.io/email/hello@microlink.io](https://unavatar.io/email/hello@microlink.io)
|
|
391
|
+
- Bare path `unavatar.io/{email}`: [unavatar.io/hello@microlink.io](https://unavatar.io/hello@microlink.io)
|
|
392
|
+
|
|
393
|
+
Explicit providers
|
|
394
|
+
|
|
395
|
+
Target a specific provider when you know where the avatar comes from.
|
|
396
|
+
|
|
397
|
+
- Gravatar (`unavatar.io/gravatar/{email-or-hash}`) — email is normalized and SHA-256 hashed; 64-hex SHA-256 or 32-hex MD5 passes through. Example: [unavatar.io/gravatar/hello@microlink.io](https://unavatar.io/gravatar/hello@microlink.io)
|
|
398
|
+
- GitHub (`unavatar.io/github/{email}`) — public profile email or commit history: [unavatar.io/github/sindresorhus@gmail.com](https://unavatar.io/github/sindresorhus@gmail.com)
|
|
399
|
+
|
|
400
|
+
e.g., [unavatar.io/email/hello@microlink.io](https://unavatar.io/email/hello@microlink.io)
|
|
353
401
|
|
|
354
402
|
### Facebook
|
|
355
403
|
|
|
@@ -361,6 +409,19 @@ Available inputs:
|
|
|
361
409
|
- Page, e.g., [unavatar.io/facebook/windtodayco](https://unavatar.io/facebook/windtodayco)
|
|
362
410
|
- Group ID, e.g., [unavatar.io/facebook/1426378481098002](https://unavatar.io/facebook/1426378481098002)
|
|
363
411
|
|
|
412
|
+
### Flickr
|
|
413
|
+
|
|
414
|
+
Get any Flickr user's buddy icon or group icon by username or group slug.
|
|
415
|
+
|
|
416
|
+
The input supports a URI format `type:id`.
|
|
417
|
+
|
|
418
|
+
When no type is provided, it defaults to `user` (user profile).
|
|
419
|
+
|
|
420
|
+
Available inputs:
|
|
421
|
+
|
|
422
|
+
- `user` (default): [unavatar.io/flickr/user:elizabethgadd](https://unavatar.io/flickr/user:elizabethgadd)
|
|
423
|
+
- `group`: [unavatar.io/flickr/group:allthingsearthy](https://unavatar.io/flickr/group:allthingsearthy)
|
|
424
|
+
|
|
364
425
|
### GitHub
|
|
365
426
|
|
|
366
427
|
Get any GitHub user or organization's profile picture by username, or resolve an avatar from a public email via GitHub search when the address matches a profile or commit history.
|
|
@@ -380,84 +441,81 @@ Available inputs:
|
|
|
380
441
|
- User, e.g., [unavatar.io/gitlab/sytses](https://unavatar.io/gitlab/sytses)
|
|
381
442
|
- Organization, e.g., [unavatar.io/gitlab/inkscape](https://unavatar.io/gitlab/inkscape)
|
|
382
443
|
|
|
383
|
-
###
|
|
384
|
-
|
|
385
|
-
Get any LinkedIn user or company profile picture by username or company slug.
|
|
444
|
+
### Google
|
|
386
445
|
|
|
387
|
-
|
|
446
|
+
Get the favicon or logo for any domain using Google's favicon service.
|
|
388
447
|
|
|
389
|
-
|
|
448
|
+
e.g., [unavatar.io/google/stremio.com](https://unavatar.io/google/stremio.com)
|
|
390
449
|
|
|
391
|
-
|
|
450
|
+
### Google Play
|
|
392
451
|
|
|
393
|
-
|
|
452
|
+
Get the icon for any Android app on Google Play by its package name, or get a developer icon by numeric ID.
|
|
394
453
|
|
|
395
|
-
|
|
396
|
-
- `company`: [unavatar.io/linkedin/company:microlinkhq](https://unavatar.io/linkedin/company:microlinkhq)
|
|
397
|
-
|
|
398
|
-
### Google
|
|
454
|
+
The input supports a URI format `type:id`.
|
|
399
455
|
|
|
400
|
-
|
|
456
|
+
When no type is provided, the input is treated as a package name (`app`).
|
|
401
457
|
|
|
402
458
|
Available inputs:
|
|
403
459
|
|
|
404
|
-
-
|
|
460
|
+
- `app` (default): [unavatar.io/google-play/app:com.devolver.grispaid](https://unavatar.io/google-play/app:com.devolver.grispaid)
|
|
461
|
+
- `dev`: [unavatar.io/google-play/dev:6592603558263828430](https://unavatar.io/google-play/dev:6592603558263828430)
|
|
405
462
|
|
|
406
463
|
### Gravatar
|
|
407
464
|
|
|
408
|
-
|
|
465
|
+
Resolve avatars via Gravatar using a plain email or a precomputed hash. Emails are trimmed, lowercased, and hashed with SHA-256 for the Gravatar URL; 64-hex SHA-256 and 32-hex MD5 values are passed through (normalized to lowercase).
|
|
409
466
|
|
|
410
467
|
Available inputs:
|
|
411
468
|
|
|
412
469
|
- Email address, e.g., [unavatar.io/gravatar/hello@microlink.io](https://unavatar.io/gravatar/hello@microlink.io)
|
|
470
|
+
- SHA-256 hash, e.g., [unavatar.io/gravatar/b1f507c7a29adfa84eaa521036774b0577c58f23f2f3f42e068d6ac256cffae2](https://unavatar.io/gravatar/b1f507c7a29adfa84eaa521036774b0577c58f23f2f3f42e068d6ac256cffae2)
|
|
471
|
+
- MD5 hash, e.g., [unavatar.io/gravatar/3f293df98a473eae038deabe430a1e30](https://unavatar.io/gravatar/3f293df98a473eae038deabe430a1e30)
|
|
413
472
|
|
|
414
473
|
### Instagram
|
|
415
474
|
|
|
416
475
|
Get any Instagram user's profile picture by their username. No authentication or API tokens needed — just pass the username.
|
|
417
476
|
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
- Username, e.g., [unavatar.io/instagram/willsmith](https://unavatar.io/instagram/willsmith)
|
|
477
|
+
e.g., [unavatar.io/instagram/willsmith](https://unavatar.io/instagram/willsmith)
|
|
421
478
|
|
|
422
479
|
### Ko-fi
|
|
423
480
|
|
|
424
481
|
Get any Ko-fi page's profile picture by the creator username.
|
|
425
482
|
|
|
426
|
-
|
|
483
|
+
e.g., [unavatar.io/ko-fi/geekshock](https://unavatar.io/ko-fi/geekshock)
|
|
427
484
|
|
|
428
|
-
|
|
485
|
+
### LinkedIn
|
|
429
486
|
|
|
430
|
-
|
|
487
|
+
Get any LinkedIn user or company profile picture by username or company slug.
|
|
431
488
|
|
|
432
|
-
|
|
489
|
+
The endpoint supports explicit type as part of the input.
|
|
433
490
|
|
|
434
491
|
Available inputs:
|
|
435
492
|
|
|
436
|
-
-
|
|
493
|
+
- `user` (default): [unavatar.io/linkedin/user:wesbos](https://unavatar.io/linkedin/user:wesbos)
|
|
494
|
+
- `company`: [unavatar.io/linkedin/company:microlinkhq](https://unavatar.io/linkedin/company:microlinkhq)
|
|
437
495
|
|
|
438
|
-
###
|
|
496
|
+
### Mastodon
|
|
439
497
|
|
|
440
|
-
|
|
498
|
+
Get any Mastodon user's profile picture from any instance using the public account lookup API. Pass the handle as `user@server` so the account resolves on the correct home instance.
|
|
441
499
|
|
|
442
|
-
|
|
500
|
+
e.g., [unavatar.io/mastodon/kpwags@hachyderm.io](https://unavatar.io/mastodon/kpwags@hachyderm.io)
|
|
443
501
|
|
|
444
|
-
|
|
502
|
+
### Medium
|
|
445
503
|
|
|
446
|
-
|
|
504
|
+
Get any Medium author's profile picture by their username.
|
|
447
505
|
|
|
448
|
-
|
|
506
|
+
e.g., [unavatar.io/medium/juancalmaraz](https://unavatar.io/medium/juancalmaraz)
|
|
449
507
|
|
|
450
|
-
|
|
508
|
+
### Microlink
|
|
509
|
+
|
|
510
|
+
Extract the logo or representative image from any URL. The page is rendered and the best available image is selected — useful for getting brand logos from any website.
|
|
451
511
|
|
|
452
|
-
|
|
512
|
+
e.g., [unavatar.io/microlink/microlink.io](https://unavatar.io/microlink/microlink.io)
|
|
453
513
|
|
|
454
514
|
### OnlyFans
|
|
455
515
|
|
|
456
516
|
Get any OnlyFans creator's profile picture by their username.
|
|
457
517
|
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
- Username, e.g., [unavatar.io/onlyfans/amandaribas](https://unavatar.io/onlyfans/amandaribas)
|
|
518
|
+
e.g., [unavatar.io/onlyfans/amandaribas](https://unavatar.io/onlyfans/amandaribas)
|
|
461
519
|
|
|
462
520
|
### OpenStreetMap
|
|
463
521
|
|
|
@@ -472,33 +530,25 @@ Available inputs:
|
|
|
472
530
|
|
|
473
531
|
Get any Patreon creator's profile picture by their username.
|
|
474
532
|
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
- Username, e.g., [unavatar.io/patreon/gametestro](https://unavatar.io/patreon/gametestro)
|
|
533
|
+
e.g., [unavatar.io/patreon/gametestro](https://unavatar.io/patreon/gametestro)
|
|
478
534
|
|
|
479
535
|
### Pinterest
|
|
480
536
|
|
|
481
537
|
Get any Pinterest user's profile picture by their username.
|
|
482
538
|
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
- Username, e.g., [unavatar.io/pinterest/ohjoy](https://unavatar.io/pinterest/ohjoy)
|
|
539
|
+
e.g., [unavatar.io/pinterest/ohjoy](https://unavatar.io/pinterest/ohjoy)
|
|
486
540
|
|
|
487
541
|
### Printables
|
|
488
542
|
|
|
489
543
|
Get any Printables user's profile picture by their username.
|
|
490
544
|
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
- Username, e.g., [unavatar.io/printables/DukeDoks](https://unavatar.io/printables/DukeDoks)
|
|
545
|
+
e.g., [unavatar.io/printables/DukeDoks](https://unavatar.io/printables/DukeDoks)
|
|
494
546
|
|
|
495
547
|
### PSN Profiles
|
|
496
548
|
|
|
497
549
|
Get any PlayStation Network user's profile picture by their PSN username.
|
|
498
550
|
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
- Username, e.g., [unavatar.io/psnprofiles/Duff85](https://unavatar.io/psnprofiles/Duff85)
|
|
551
|
+
e.g., [unavatar.io/psnprofiles/Duff85](https://unavatar.io/psnprofiles/Duff85)
|
|
502
552
|
|
|
503
553
|
### Reddit
|
|
504
554
|
|
|
@@ -513,29 +563,23 @@ Available inputs:
|
|
|
513
563
|
|
|
514
564
|
Get any Snapchat user's profile picture by their username.
|
|
515
565
|
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
- Username, e.g., [unavatar.io/snapchat/teddysdaytoday](https://unavatar.io/snapchat/teddysdaytoday)
|
|
566
|
+
e.g., [unavatar.io/snapchat/teddysdaytoday](https://unavatar.io/snapchat/teddysdaytoday)
|
|
519
567
|
|
|
520
568
|
### SoundCloud
|
|
521
569
|
|
|
522
570
|
Get any SoundCloud artist's profile picture by their username.
|
|
523
571
|
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
- Username, e.g., [unavatar.io/soundcloud/gorillaz](https://unavatar.io/soundcloud/gorillaz)
|
|
572
|
+
e.g., [unavatar.io/soundcloud/gorillaz](https://unavatar.io/soundcloud/gorillaz)
|
|
527
573
|
|
|
528
574
|
### Spotify
|
|
529
575
|
|
|
530
576
|
Get artwork for any Spotify entity — users, artists, albums, playlists, shows, episodes, or tracks. Look up by username or Spotify ID.
|
|
531
577
|
|
|
532
|
-
e.g., [unavatar.io/spotify/album:7I9Wh2IgvI3Nnr8Z1ZSWby](https://unavatar.io/spotify/album:7I9Wh2IgvI3Nnr8Z1ZSWby)
|
|
533
|
-
|
|
534
578
|
The endpoint supports explicit type as part of the input.
|
|
535
579
|
|
|
536
580
|
If explicit type is not provided, it defaults to `user`.
|
|
537
581
|
|
|
538
|
-
Available
|
|
582
|
+
Available inputs:
|
|
539
583
|
|
|
540
584
|
- `album`: [unavatar.io/spotify/album:7I9Wh2IgvI3Nnr8Z1ZSWby](https://unavatar.io/spotify/album:7I9Wh2IgvI3Nnr8Z1ZSWby)
|
|
541
585
|
- `artist`: [unavatar.io/spotify/artist:1vCWHaC5f2uS3yhpwWbIA6](https://unavatar.io/spotify/artist:1vCWHaC5f2uS3yhpwWbIA6)
|
|
@@ -545,17 +589,21 @@ Available URI format inputs:
|
|
|
545
589
|
- `track`: [unavatar.io/spotify/track:4OROzZUy6gOWN4UGQVaZMF](https://unavatar.io/spotify/track:4OROzZUy6gOWN4UGQVaZMF)
|
|
546
590
|
- `user` (default): [unavatar.io/spotify/user:kikobeats](https://unavatar.io/spotify/user:kikobeats)
|
|
547
591
|
|
|
592
|
+
### Stack Overflow
|
|
593
|
+
|
|
594
|
+
Get any Stack Overflow user's profile picture by their numeric user ID only (slug paths are not supported).
|
|
595
|
+
|
|
596
|
+
e.g., [unavatar.io/stackoverflow/19082](https://unavatar.io/stackoverflow/19082)
|
|
597
|
+
|
|
548
598
|
### Steam
|
|
549
599
|
|
|
550
600
|
Get any Steam player or community group profile picture by public profile name, numeric account ID, or group name.
|
|
551
601
|
|
|
552
|
-
e.g., [unavatar.io/steam/id:gabelogannewell](https://unavatar.io/steam/id:gabelogannewell)
|
|
553
|
-
|
|
554
602
|
The input supports a URI format `type:value`.
|
|
555
603
|
|
|
556
604
|
When no type is provided, it defaults to `id` (player profile name).
|
|
557
605
|
|
|
558
|
-
Available
|
|
606
|
+
Available inputs:
|
|
559
607
|
|
|
560
608
|
- `id` (default): [unavatar.io/steam/id:gabelogannewell](https://unavatar.io/steam/id:gabelogannewell)
|
|
561
609
|
- `profile`: [unavatar.io/steam/profile:76561198044605749](https://unavatar.io/steam/profile:76561198044605749)
|
|
@@ -565,69 +613,53 @@ Available URI format inputs:
|
|
|
565
613
|
|
|
566
614
|
Get any Substack author's profile picture by their publication username.
|
|
567
615
|
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
- Publication username, e.g., [unavatar.io/substack/bankless](https://unavatar.io/substack/bankless)
|
|
616
|
+
e.g., [unavatar.io/substack/bankless](https://unavatar.io/substack/bankless)
|
|
571
617
|
|
|
572
618
|
### Telegram
|
|
573
619
|
|
|
574
620
|
Get any Telegram user's profile picture by their username.
|
|
575
621
|
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
- Username, e.g., [unavatar.io/telegram/drsdavidsoft](https://unavatar.io/telegram/drsdavidsoft)
|
|
622
|
+
e.g., [unavatar.io/telegram/drsdavidsoft](https://unavatar.io/telegram/drsdavidsoft)
|
|
579
623
|
|
|
580
624
|
### Threads
|
|
581
625
|
|
|
582
626
|
Get any Threads user's profile picture by their username.
|
|
583
627
|
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
- Username, e.g., [unavatar.io/threads/zuck](https://unavatar.io/threads/zuck)
|
|
628
|
+
e.g., [unavatar.io/threads/zuck](https://unavatar.io/threads/zuck)
|
|
587
629
|
|
|
588
630
|
### TikTok
|
|
589
631
|
|
|
590
632
|
Get any TikTok user's profile picture by their username. No authentication or API tokens needed — just pass the username.
|
|
591
633
|
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
- Username, e.g., [unavatar.io/tiktok/carlosazaustre](https://unavatar.io/tiktok/carlosazaustre)
|
|
634
|
+
e.g., [unavatar.io/tiktok/carlosazaustre](https://unavatar.io/tiktok/carlosazaustre)
|
|
595
635
|
|
|
596
636
|
### Tumblr
|
|
597
637
|
|
|
598
638
|
Get any Tumblr blog's profile picture by their username.
|
|
599
639
|
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
- Username, e.g., [unavatar.io/tumblr/nasa](https://unavatar.io/tumblr/nasa)
|
|
640
|
+
e.g., [unavatar.io/tumblr/nasa](https://unavatar.io/tumblr/nasa)
|
|
603
641
|
|
|
604
642
|
### Twitch
|
|
605
643
|
|
|
606
644
|
Get any Twitch streamer's profile picture by their username.
|
|
607
645
|
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
- Username, e.g., [unavatar.io/twitch/midudev](https://unavatar.io/twitch/midudev)
|
|
646
|
+
e.g., [unavatar.io/twitch/midudev](https://unavatar.io/twitch/midudev)
|
|
611
647
|
|
|
612
648
|
### Vimeo
|
|
613
649
|
|
|
614
650
|
Get any Vimeo user's profile picture by their username.
|
|
615
651
|
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
- Username, e.g., [unavatar.io/vimeo/ladieswithlenses](https://unavatar.io/vimeo/ladieswithlenses)
|
|
652
|
+
e.g., [unavatar.io/vimeo/ladieswithlenses](https://unavatar.io/vimeo/ladieswithlenses)
|
|
619
653
|
|
|
620
654
|
### WhatsApp
|
|
621
655
|
|
|
622
656
|
Get the profile picture for a WhatsApp channel or chat by ID.
|
|
623
657
|
|
|
624
|
-
e.g., [unavatar.io/whatsapp/phone:34660021551](https://unavatar.io/whatsapp/phone:34660021551)
|
|
625
|
-
|
|
626
658
|
The input supports a URI format `type:id`.
|
|
627
659
|
|
|
628
660
|
If no type is provided, the input is treated as a phone number.
|
|
629
661
|
|
|
630
|
-
Available
|
|
662
|
+
Available inputs:
|
|
631
663
|
|
|
632
664
|
- `phone`: [unavatar.io/whatsapp/phone:34660021551](https://unavatar.io/whatsapp/phone:34660021551)
|
|
633
665
|
- `channel`: [unavatar.io/whatsapp/channel:0029VaARuQ7KwqSXh9fiMc0m](https://unavatar.io/whatsapp/channel:0029VaARuQ7KwqSXh9fiMc0m)
|
|
@@ -637,24 +669,18 @@ Available URI format inputs:
|
|
|
637
669
|
|
|
638
670
|
Get any X (formerly Twitter) user's profile picture by their username.
|
|
639
671
|
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
- Username, e.g., [unavatar.io/x/elonmusk](https://unavatar.io/x/elonmusk)
|
|
672
|
+
e.g., [unavatar.io/x/elonmusk](https://unavatar.io/x/elonmusk)
|
|
643
673
|
|
|
644
674
|
### Xbox Gamertag
|
|
645
675
|
|
|
646
676
|
Get any Xbox player's profile picture by their gamertag.
|
|
647
677
|
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
- Gamertag, e.g., [unavatar.io/xboxgamertag/GD-BerserkerTTD](https://unavatar.io/xboxgamertag/GD-BerserkerTTD)
|
|
678
|
+
e.g., [unavatar.io/xboxgamertag/GD-BerserkerTTD](https://unavatar.io/xboxgamertag/GD-BerserkerTTD)
|
|
651
679
|
|
|
652
680
|
### YouTube
|
|
653
681
|
|
|
654
682
|
Get any YouTube channel's thumbnail by their handle, legacy username, or channel ID.
|
|
655
683
|
|
|
656
|
-
e.g., [unavatar.io/youtube/casey](https://unavatar.io/youtube/casey)
|
|
657
|
-
|
|
658
684
|
The endpoint supports specific input formats.
|
|
659
685
|
|
|
660
686
|
If the input starts with `UC` and has 24 characters, it is treated as a channel ID. Otherwise, it is treated as a handle.
|
package/bin/index.js
CHANGED
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.
|
|
5
|
+
"version": "3.25.4",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": "./src/index.js",
|
|
@@ -8,12 +8,32 @@ const COUNTRY_CODE_REGEX = /^[a-z]{2}$/i
|
|
|
8
8
|
const getArtworkUrl = result =>
|
|
9
9
|
result?.artworkUrl512 || result?.artworkUrl100 || result?.artworkUrl60
|
|
10
10
|
|
|
11
|
+
const normalizeName = value =>
|
|
12
|
+
typeof value === 'string'
|
|
13
|
+
? value
|
|
14
|
+
.trim()
|
|
15
|
+
.toLowerCase()
|
|
16
|
+
.normalize('NFD')
|
|
17
|
+
.replace(/[\u0300-\u036f]/g, '')
|
|
18
|
+
.replace(/\s+/g, ' ')
|
|
19
|
+
: ''
|
|
20
|
+
|
|
21
|
+
const isAppNameMatch = ({ result, name }) => {
|
|
22
|
+
const query = normalizeName(name)
|
|
23
|
+
if (!query) return false
|
|
24
|
+
|
|
25
|
+
const trackName = normalizeName(result?.trackName)
|
|
26
|
+
const trackCensoredName = normalizeName(result?.trackCensoredName)
|
|
27
|
+
|
|
28
|
+
return trackName === query || trackCensoredName === query
|
|
29
|
+
}
|
|
30
|
+
|
|
11
31
|
const withCountry = ({ query, country }) =>
|
|
12
32
|
country ? `${query}&country=${encodeURIComponent(country)}` : query
|
|
13
33
|
|
|
14
34
|
const parseInput = input => {
|
|
15
35
|
const separatorIndex = input.indexOf(':')
|
|
16
|
-
if (separatorIndex === -1) return { type: '
|
|
36
|
+
if (separatorIndex === -1) return { type: 'id', value: input }
|
|
17
37
|
|
|
18
38
|
return {
|
|
19
39
|
type: input.slice(0, separatorIndex),
|
|
@@ -54,44 +74,14 @@ const getAppAvatar = async ({ got, id, country }) => {
|
|
|
54
74
|
return getArtworkUrl(result)
|
|
55
75
|
}
|
|
56
76
|
|
|
57
|
-
const getDeveloperAvatar = async ({ got, id, country }) => {
|
|
58
|
-
const query = withCountry({
|
|
59
|
-
query: `id=${encodeURIComponent(id)}&entity=software&limit=200`,
|
|
60
|
-
country
|
|
61
|
-
})
|
|
62
|
-
const results = await getLookupResults({ got, query })
|
|
63
|
-
const softwareResult = results.find(result => result?.kind === 'software')
|
|
64
|
-
return getArtworkUrl(softwareResult)
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const getBundleAvatar = async ({ got, bundleId, country }) => {
|
|
68
|
-
const query = withCountry({
|
|
69
|
-
query: `bundleId=${encodeURIComponent(bundleId)}&entity=software&limit=1`,
|
|
70
|
-
country
|
|
71
|
-
})
|
|
72
|
-
const [result] = await getLookupResults({ got, query })
|
|
73
|
-
return getArtworkUrl(result)
|
|
74
|
-
}
|
|
75
|
-
|
|
76
77
|
const getAppNameAvatar = async ({ got, name, country, searchResults }) => {
|
|
77
78
|
const getSearchResults = searchResults || createGetSearchResults({ got })
|
|
78
79
|
const query = withCountry({
|
|
79
|
-
query: `term=${encodeURIComponent(name)}&entity=software&limit=
|
|
80
|
-
country
|
|
81
|
-
})
|
|
82
|
-
const [result] = await getSearchResults(query)
|
|
83
|
-
return getArtworkUrl(result)
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
const getDeveloperNameAvatar = async ({ got, name, country, searchResults }) => {
|
|
87
|
-
const getSearchResults = searchResults || createGetSearchResults({ got })
|
|
88
|
-
const query = withCountry({
|
|
89
|
-
query: `term=${encodeURIComponent(
|
|
90
|
-
name
|
|
91
|
-
)}&entity=software&attribute=softwareDeveloper&limit=1`,
|
|
80
|
+
query: `term=${encodeURIComponent(name)}&entity=software&limit=5`,
|
|
92
81
|
country
|
|
93
82
|
})
|
|
94
|
-
const
|
|
83
|
+
const results = await getSearchResults(query)
|
|
84
|
+
const result = results.find(item => isAppNameMatch({ result: item, name }))
|
|
95
85
|
return getArtworkUrl(result)
|
|
96
86
|
}
|
|
97
87
|
|
|
@@ -103,16 +93,10 @@ module.exports = ({ got, itunesSearchCache }) => {
|
|
|
103
93
|
const { value, country } = parseCountry(rawValue)
|
|
104
94
|
|
|
105
95
|
switch (type) {
|
|
106
|
-
case '
|
|
96
|
+
case 'id':
|
|
107
97
|
return getAppAvatar({ got, id: value, country })
|
|
108
|
-
case '
|
|
109
|
-
return getDeveloperAvatar({ got, id: value, country })
|
|
110
|
-
case 'bundle':
|
|
111
|
-
return getBundleAvatar({ got, bundleId: value, country })
|
|
112
|
-
case 'app-name':
|
|
98
|
+
case 'name':
|
|
113
99
|
return getAppNameAvatar({ got, name: value, country, searchResults })
|
|
114
|
-
case 'dev-name':
|
|
115
|
-
return getDeveloperNameAvatar({ got, name: value, country, searchResults })
|
|
116
100
|
default:
|
|
117
101
|
throw new Error(`Unsupported Apple Store type: ${type}`)
|
|
118
102
|
}
|
|
@@ -120,7 +104,4 @@ module.exports = ({ got, itunesSearchCache }) => {
|
|
|
120
104
|
}
|
|
121
105
|
|
|
122
106
|
module.exports.getAppAvatar = getAppAvatar
|
|
123
|
-
module.exports.getDeveloperAvatar = getDeveloperAvatar
|
|
124
|
-
module.exports.getBundleAvatar = getBundleAvatar
|
|
125
107
|
module.exports.getAppNameAvatar = getAppNameAvatar
|
|
126
|
-
module.exports.getDeveloperNameAvatar = getDeveloperNameAvatar
|