@unavatar/core 3.41.0 → 3.42.1

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
@@ -24,6 +24,7 @@
24
24
  - [Buy Me a Coffee](#buy-me-a-coffee)
25
25
  - [CodePen](#codepen)
26
26
  - [Cults3D](#cults3d)
27
+ - [Cursor](#cursor)
27
28
  - [DeviantArt](#deviantart)
28
29
  - [Discord](#discord)
29
30
  - [Docker Hub](#docker-hub)
@@ -38,6 +39,7 @@
38
39
  - [Google](#google)
39
40
  - [Google Play](#google-play)
40
41
  - [Gravatar](#gravatar)
42
+ - [Hevy](#hevy)
41
43
  - [Hugging Face](#hugging-face)
42
44
  - [Instagram](#instagram)
43
45
  - [Ko-fi](#ko-fi)
@@ -49,18 +51,19 @@
49
51
  - [OnlyFans](#onlyfans)
50
52
  - [OpenStreetMap](#openstreetmap)
51
53
  - [Patreon](#patreon)
52
- - [PayPal](#paypal)
53
54
  - [Pinterest](#pinterest)
55
+ - [Primal](#primal)
54
56
  - [Printables](#printables)
55
57
  - [Product Hunt](#product-hunt)
56
58
  - [PSN Profiles](#psn-profiles)
59
+ - [Raycast](#raycast)
57
60
  - [Reddit](#reddit)
58
- - [Revolut](#revolut)
59
61
  - [Snapchat](#snapchat)
60
62
  - [SoundCloud](#soundcloud)
61
63
  - [Spotify](#spotify)
62
64
  - [Stack Overflow](#stack-overflow)
63
65
  - [Steam](#steam)
66
+ - [Strava](#strava)
64
67
  - [Substack](#substack)
65
68
  - [Telegram](#telegram)
66
69
  - [Thingiverse](#thingiverse)
@@ -68,10 +71,8 @@
68
71
  - [TikTok](#tiktok)
69
72
  - [Tumblr](#tumblr)
70
73
  - [Twitch](#twitch)
71
- - [Venmo](#venmo)
72
74
  - [Vimeo](#vimeo)
73
75
  - [WhatsApp](#whatsapp)
74
- - [Wise](#wise)
75
76
  - [X/Twitter](#xtwitter)
76
77
  - [Xbox Gamertag](#xbox-gamertag)
77
78
  - [YouTube](#youtube)
@@ -588,6 +589,12 @@ Get any Cults3D creator's profile picture by username.
588
589
 
589
590
  e.g., [unavatar.io/cults3d/RaBros](https://unavatar.io/cults3d/RaBros)
590
591
 
592
+ ### Cursor
593
+
594
+ Get any Cursor user's profile picture by their username.
595
+
596
+ e.g., [unavatar.io/cursor/leerob](https://unavatar.io/cursor/leerob)
597
+
591
598
  ### DeviantArt
592
599
 
593
600
  Get any DeviantArt user's profile picture by their username.
@@ -723,6 +730,12 @@ When you pass an email address directly in the URL, it is visible in plain text
723
730
 
724
731
  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.
725
732
 
733
+ ### Hevy
734
+
735
+ Get any Hevy user's profile picture by their username.
736
+
737
+ e.g., [unavatar.io/hevy/om_giigo](https://unavatar.io/hevy/om_giigo)
738
+
726
739
  ### Hugging Face
727
740
 
728
741
  Get profile pictures for Hugging Face users or organizations by their handle.
@@ -800,18 +813,18 @@ Get any Patreon creator's profile picture by their username.
800
813
 
801
814
  e.g., [unavatar.io/patreon/gametestro](https://unavatar.io/patreon/gametestro)
802
815
 
803
- ### PayPal
804
-
805
- Get any PayPal user's profile picture by their PayPal.Me username.
806
-
807
- e.g., [unavatar.io/paypal/kikobeats](https://unavatar.io/paypal/kikobeats)
808
-
809
816
  ### Pinterest
810
817
 
811
818
  Get any Pinterest user's profile picture by their username.
812
819
 
813
820
  e.g., [unavatar.io/pinterest/ohjoy](https://unavatar.io/pinterest/ohjoy)
814
821
 
822
+ ### Primal
823
+
824
+ Get any Primal user's profile picture by their username.
825
+
826
+ e.g., [unavatar.io/primal/jack](https://unavatar.io/primal/jack)
827
+
815
828
  ### Printables
816
829
 
817
830
  Get any Printables user's profile picture by their username.
@@ -837,6 +850,12 @@ Get any PlayStation Network user's profile picture by their PSN username.
837
850
 
838
851
  e.g., [unavatar.io/psnprofiles/Duff85](https://unavatar.io/psnprofiles/Duff85)
839
852
 
853
+ ### Raycast
854
+
855
+ Get any Raycast user's profile picture by their username.
856
+
857
+ e.g., [unavatar.io/raycast/peduarte](https://unavatar.io/raycast/peduarte)
858
+
840
859
  ### Reddit
841
860
 
842
861
  Get any Reddit user's avatar by their username.
@@ -846,12 +865,6 @@ Available inputs:
846
865
  - Username, e.g., [unavatar.io/reddit/thisisbillgates](https://unavatar.io/reddit/thisisbillgates)
847
866
  - Organization, e.g., [unavatar.io/reddit/nasa](https://unavatar.io/reddit/nasa)
848
867
 
849
- ### Revolut
850
-
851
- Get any Revolut user's profile picture by their Revolut.Me username.
852
-
853
- e.g., [unavatar.io/revolut/midudev](https://unavatar.io/revolut/midudev)
854
-
855
868
  ### Snapchat
856
869
 
857
870
  Get any Snapchat user's profile picture by their username.
@@ -902,6 +915,12 @@ Available inputs:
902
915
  - `profile`: [unavatar.io/steam/profile:76561198044605749](https://unavatar.io/steam/profile:76561198044605749)
903
916
  - `group`: [unavatar.io/steam/group:murcia-gaming](https://unavatar.io/steam/group:murcia-gaming)
904
917
 
918
+ ### Strava
919
+
920
+ Get any Strava athlete's profile picture by their username or athlete ID.
921
+
922
+ e.g., [unavatar.io/strava/kikobeats](https://unavatar.io/strava/kikobeats)
923
+
905
924
  ### Substack
906
925
 
907
926
  Get any Substack author's profile picture by their publication username.
@@ -944,12 +963,6 @@ Get any Twitch streamer's profile picture by their username.
944
963
 
945
964
  e.g., [unavatar.io/twitch/midudev](https://unavatar.io/twitch/midudev)
946
965
 
947
- ### Venmo
948
-
949
- Get any Venmo user's profile picture by their username.
950
-
951
- e.g., [unavatar.io/venmo/Jessica-Lee-77](https://unavatar.io/venmo/Jessica-Lee-77)
952
-
953
966
  ### Vimeo
954
967
 
955
968
  Get any Vimeo user's profile picture by their username.
@@ -970,12 +983,6 @@ Available inputs:
970
983
  - `channel`: [unavatar.io/whatsapp/channel:0029VaARuQ7KwqSXh9fiMc0m](https://unavatar.io/whatsapp/channel:0029VaARuQ7KwqSXh9fiMc0m)
971
984
  - `chat`: [unavatar.io/whatsapp/chat:D2FFycjQXrEIKG8qQjbwZz](https://unavatar.io/whatsapp/chat:D2FFycjQXrEIKG8qQjbwZz)
972
985
 
973
- ### Wise
974
-
975
- Get any Wise user's profile picture by their Wisetag.
976
-
977
- e.g., [unavatar.io/wise/josev2264](https://unavatar.io/wise/josev2264)
978
-
979
986
  ### X/Twitter
980
987
 
981
988
  Get any X (formerly Twitter) user's profile picture by their username.
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.41.0",
5
+ "version": "3.42.1",
6
6
  "main": "src/index.js",
7
7
  "exports": {
8
8
  ".": "./src/index.js",
@@ -0,0 +1,48 @@
1
+ 'use strict'
2
+
3
+ const { get } = require('lodash')
4
+
5
+ const getAvatarUrl = input => `https://cash.app/$${input.replace(/^\$/, '')}`
6
+
7
+ // Extracts the first balanced `{...}` object after `marker`, respecting string
8
+ // literals so a `}` inside a value (e.g. a display name) doesn't end it early.
9
+ const extractObject = (source, marker) => {
10
+ const start = source.indexOf(marker)
11
+ if (start === -1) return
12
+ const open = source.indexOf('{', start)
13
+ if (open === -1) return
14
+ let depth = 0
15
+ let inString = false
16
+ let escaped = false
17
+ for (let index = open; index < source.length; index++) {
18
+ const char = source[index]
19
+ if (inString) {
20
+ if (escaped) escaped = false
21
+ else if (char === '\\') escaped = true
22
+ else if (char === '"') inString = false
23
+ } else if (char === '"') inString = true
24
+ else if (char === '{') depth++
25
+ else if (char === '}' && --depth === 0) return source.slice(open, index + 1)
26
+ }
27
+ }
28
+
29
+ const getAvatar = ({ $, NOT_FOUND }) => {
30
+ const script = $('script')
31
+ .filter((_, el) => $(el).text().includes('var profile ='))
32
+ .text()
33
+ const json = extractObject(script, 'var profile =')
34
+ if (!json) return NOT_FOUND
35
+ return get(JSON.parse(json), ['avatar', 'image_url']) ?? NOT_FOUND
36
+ }
37
+
38
+ const factory = ({ createHtmlProvider, NOT_FOUND }) =>
39
+ createHtmlProvider({
40
+ name: 'cashapp',
41
+ url: getAvatarUrl,
42
+ getter: $ => getAvatar({ $, NOT_FOUND })
43
+ })
44
+
45
+ factory.getAvatarUrl = getAvatarUrl
46
+ factory.getAvatar = getAvatar
47
+
48
+ module.exports = factory
@@ -8,6 +8,7 @@ const providersBy = {
8
8
  'behance',
9
9
  'bluesky',
10
10
  'buymeacoffee',
11
+ 'cashapp',
11
12
  'codepen',
12
13
  'cults3d',
13
14
  'cursor',
@@ -70,6 +71,7 @@ module.exports = ctx => {
70
71
  behance: require('./behance')(ctx),
71
72
  bluesky: require('./bluesky')(ctx),
72
73
  buymeacoffee: require('./buymeacoffee')(ctx),
74
+ cashapp: require('./cashapp')(ctx),
73
75
  codepen: require('./codepen')(ctx),
74
76
  cults3d: require('./cults3d')(ctx),
75
77
  cursor: require('./cursor')(ctx),