@unavatar/core 3.35.0 → 3.37.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
@@ -55,12 +55,14 @@
55
55
  - [Primal](#primal)
56
56
  - [Product Hunt](#product-hunt)
57
57
  - [PSN Profiles](#psn-profiles)
58
+ - [Raycast](#raycast)
58
59
  - [Reddit](#reddit)
59
60
  - [Snapchat](#snapchat)
60
61
  - [SoundCloud](#soundcloud)
61
62
  - [Spotify](#spotify)
62
63
  - [Stack Overflow](#stack-overflow)
63
64
  - [Steam](#steam)
65
+ - [Strava](#strava)
64
66
  - [Substack](#substack)
65
67
  - [Telegram](#telegram)
66
68
  - [Thingiverse](#thingiverse)
@@ -842,6 +844,12 @@ Get any PlayStation Network user's profile picture by their PSN username.
842
844
 
843
845
  e.g., [unavatar.io/psnprofiles/Duff85](https://unavatar.io/psnprofiles/Duff85)
844
846
 
847
+ ### Raycast
848
+
849
+ Get any Raycast user's profile picture by their username.
850
+
851
+ e.g., [unavatar.io/raycast/kikobeats](https://unavatar.io/raycast/kikobeats)
852
+
845
853
  ### Reddit
846
854
 
847
855
  Get any Reddit user's avatar by their username.
@@ -901,6 +909,12 @@ Available inputs:
901
909
  - `profile`: [unavatar.io/steam/profile:76561198044605749](https://unavatar.io/steam/profile:76561198044605749)
902
910
  - `group`: [unavatar.io/steam/group:murcia-gaming](https://unavatar.io/steam/group:murcia-gaming)
903
911
 
912
+ ### Strava
913
+
914
+ Get any Strava athlete's profile picture by their username or athlete ID.
915
+
916
+ e.g., [unavatar.io/strava/kikobeats](https://unavatar.io/strava/kikobeats)
917
+
904
918
  ### Substack
905
919
 
906
920
  Get any Substack author's profile picture by their publication 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.35.0",
5
+ "version": "3.37.0",
6
6
  "main": "src/index.js",
7
7
  "exports": {
8
8
  ".": "./src/index.js",
@@ -36,12 +36,14 @@ const providersBy = {
36
36
  'primal',
37
37
  'producthunt',
38
38
  'psnprofiles',
39
+ 'raycast',
39
40
  'reddit',
40
41
  'snapchat',
41
42
  'soundcloud',
42
43
  'spotify',
43
44
  'stackoverflow',
44
45
  'steam',
46
+ 'strava',
45
47
  'substack',
46
48
  'telegram',
47
49
  'thingiverse',
@@ -96,12 +98,14 @@ module.exports = ctx => {
96
98
  primal: require('./primal')(ctx),
97
99
  producthunt: require('./producthunt')(ctx),
98
100
  psnprofiles: require('./psnprofiles')(ctx),
101
+ raycast: require('./raycast')(ctx),
99
102
  reddit: require('./reddit')(ctx),
100
103
  snapchat: require('./snapchat')(ctx),
101
104
  soundcloud: require('./soundcloud')(ctx),
102
105
  spotify: require('./spotify')(ctx),
103
106
  stackoverflow: require('./stackoverflow')(ctx),
104
107
  steam: require('./steam')(ctx),
108
+ strava: require('./strava')(ctx),
105
109
  substack: require('./substack')(ctx),
106
110
  telegram: require('./telegram')(ctx),
107
111
  thingiverse: require('./thingiverse')(ctx),
@@ -0,0 +1,24 @@
1
+ 'use strict'
2
+
3
+ const getAvatarUrl = input => {
4
+ const handle = input.startsWith('@') ? input.slice(1) : input
5
+ return `https://www.raycast.com/${handle}`
6
+ }
7
+
8
+ const getAvatar = $ => {
9
+ const src = $('img[alt="Avatar"]').attr('src')
10
+ if (!src) return
11
+
12
+ const url = new URL(src, 'https://www.raycast.com')
13
+ return url.searchParams.get('url') ?? src
14
+ }
15
+
16
+ module.exports = ({ createHtmlProvider }) =>
17
+ createHtmlProvider({
18
+ name: 'raycast',
19
+ url: getAvatarUrl,
20
+ getter: getAvatar
21
+ })
22
+
23
+ module.exports.getAvatarUrl = getAvatarUrl
24
+ module.exports.getAvatar = getAvatar
@@ -0,0 +1,12 @@
1
+ 'use strict'
2
+
3
+ const getAvatarUrl = input => `https://www.strava.com/athletes/${input}`
4
+
5
+ module.exports = ({ createHtmlProvider, getOgImage }) =>
6
+ createHtmlProvider({
7
+ name: 'strava',
8
+ url: getAvatarUrl,
9
+ getter: getOgImage
10
+ })
11
+
12
+ module.exports.getAvatarUrl = getAvatarUrl