@unavatar/core 3.38.0 → 3.39.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
@@ -49,6 +49,7 @@
49
49
  - [OnlyFans](#onlyfans)
50
50
  - [OpenStreetMap](#openstreetmap)
51
51
  - [Patreon](#patreon)
52
+ - [PayPal](#paypal)
52
53
  - [Pinterest](#pinterest)
53
54
  - [Printables](#printables)
54
55
  - [Product Hunt](#product-hunt)
@@ -797,6 +798,12 @@ Get any Patreon creator's profile picture by their username.
797
798
 
798
799
  e.g., [unavatar.io/patreon/gametestro](https://unavatar.io/patreon/gametestro)
799
800
 
801
+ ### PayPal
802
+
803
+ Get any PayPal user's profile picture by their PayPal.Me username.
804
+
805
+ e.g., [unavatar.io/paypal/kikobeats](https://unavatar.io/paypal/kikobeats)
806
+
800
807
  ### Pinterest
801
808
 
802
809
  Get any Pinterest 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.38.0",
5
+ "version": "3.39.0",
6
6
  "main": "src/index.js",
7
7
  "exports": {
8
8
  ".": "./src/index.js",
@@ -31,6 +31,7 @@ const providersBy = {
31
31
  'onlyfans',
32
32
  'openstreetmap',
33
33
  'patreon',
34
+ 'paypal',
34
35
  'pinterest',
35
36
  'printables',
36
37
  'primal',
@@ -94,6 +95,7 @@ module.exports = ctx => {
94
95
  onlyfans: require('./onlyfans')(ctx),
95
96
  openstreetmap: require('./openstreetmap')(ctx),
96
97
  patreon: require('./patreon')(ctx),
98
+ paypal: require('./paypal')(ctx),
97
99
  pinterest: require('./pinterest')(ctx),
98
100
  printables: require('./printables')(ctx),
99
101
  primal: require('./primal')(ctx),
@@ -0,0 +1,28 @@
1
+ 'use strict'
2
+
3
+ const { get } = require('lodash')
4
+
5
+ const getAvatarUrl = input => `https://www.paypal.com/paypalme/${input}`
6
+
7
+ const getAvatar = $ => {
8
+ const text = $('#client-data').contents().text()
9
+ if (!text) return
10
+ return get(JSON.parse(text), [
11
+ 'recipientSlugDetails',
12
+ 'slugDetails',
13
+ 'userInfo',
14
+ 'profilePhotoUrl'
15
+ ])
16
+ }
17
+
18
+ const factory = ({ createHtmlProvider }) =>
19
+ createHtmlProvider({
20
+ name: 'paypal',
21
+ url: getAvatarUrl,
22
+ getter: getAvatar
23
+ })
24
+
25
+ factory.getAvatarUrl = getAvatarUrl
26
+ factory.getAvatar = getAvatar
27
+
28
+ module.exports = factory