@unavatar/core 3.20.0 → 3.21.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/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.20.0",
5
+ "version": "3.21.0",
6
6
  "main": "src/index.js",
7
7
  "exports": {
8
8
  ".": "./src/index.js",
@@ -0,0 +1,24 @@
1
+ 'use strict'
2
+
3
+ const getAvatarUrl = $ => {
4
+ const dataPage = $('#app').attr('data-page')
5
+ if (!dataPage) return
6
+
7
+ try {
8
+ return JSON.parse(dataPage)?.props?.creator_data?.data?.dp
9
+ } catch {
10
+ const match = dataPage.match(/"dp":"([^"]+)"/)
11
+ return match?.[1]?.replace(/\\\//g, '/')
12
+ }
13
+ }
14
+
15
+ const factory = ({ createHtmlProvider }) =>
16
+ createHtmlProvider({
17
+ name: 'buymeacoffee',
18
+ url: input => `https://buymeacoffee.com/${input}`,
19
+ getter: getAvatarUrl
20
+ })
21
+
22
+ factory.getAvatarUrl = getAvatarUrl
23
+
24
+ module.exports = factory
@@ -6,6 +6,7 @@ const providersBy = {
6
6
  'apple-music',
7
7
  'behance',
8
8
  'bluesky',
9
+ 'buymeacoffee',
9
10
  'deviantart',
10
11
  'discord',
11
12
  'dribbble',
@@ -48,6 +49,7 @@ module.exports = ctx => {
48
49
  'apple-music': require('./apple-music')(ctx),
49
50
  behance: require('./behance')(ctx),
50
51
  bluesky: require('./bluesky')(ctx),
52
+ buymeacoffee: require('./buymeacoffee')(ctx),
51
53
  deviantart: require('./deviantart')(ctx),
52
54
  discord: require('./discord')(ctx),
53
55
  dribbble: require('./dribbble')(ctx),