@unavatar/core 3.40.0 → 3.41.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
@@ -68,6 +68,7 @@
68
68
  - [TikTok](#tiktok)
69
69
  - [Tumblr](#tumblr)
70
70
  - [Twitch](#twitch)
71
+ - [Venmo](#venmo)
71
72
  - [Vimeo](#vimeo)
72
73
  - [WhatsApp](#whatsapp)
73
74
  - [Wise](#wise)
@@ -943,6 +944,12 @@ Get any Twitch streamer's profile picture by their username.
943
944
 
944
945
  e.g., [unavatar.io/twitch/midudev](https://unavatar.io/twitch/midudev)
945
946
 
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
+
946
953
  ### Vimeo
947
954
 
948
955
  Get any Vimeo 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.40.0",
5
+ "version": "3.41.0",
6
6
  "main": "src/index.js",
7
7
  "exports": {
8
8
  ".": "./src/index.js",
@@ -53,6 +53,7 @@ const providersBy = {
53
53
  'tiktok',
54
54
  'tumblr',
55
55
  'twitch',
56
+ 'venmo',
56
57
  'vimeo',
57
58
  'wise',
58
59
  'x',
@@ -118,6 +119,7 @@ module.exports = ctx => {
118
119
  tiktok: require('./tiktok')(ctx),
119
120
  tumblr: require('./tumblr')(ctx),
120
121
  twitch: require('./twitch')(ctx),
122
+ venmo: require('./venmo')(ctx),
121
123
  vimeo: require('./vimeo')(ctx),
122
124
  whatsapp: require('./whatsapp')(ctx),
123
125
  wise: require('./wise')(ctx),
@@ -0,0 +1,28 @@
1
+ 'use strict'
2
+
3
+ const { get } = require('lodash')
4
+
5
+ const getAvatarUrl = input => `https://account.venmo.com/u/${input}`
6
+
7
+ const getAvatar = $ => {
8
+ const text = $('#__NEXT_DATA__').contents().text()
9
+ if (!text) return
10
+ return get(JSON.parse(text), [
11
+ 'props',
12
+ 'pageProps',
13
+ 'user',
14
+ 'profilePictureUrl'
15
+ ])
16
+ }
17
+
18
+ const factory = ({ createHtmlProvider }) =>
19
+ createHtmlProvider({
20
+ name: 'venmo',
21
+ url: getAvatarUrl,
22
+ getter: getAvatar
23
+ })
24
+
25
+ factory.getAvatarUrl = getAvatarUrl
26
+ factory.getAvatar = getAvatar
27
+
28
+ module.exports = factory