@unavatar/core 3.18.0 → 3.19.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
@@ -591,12 +591,15 @@ Available inputs:
591
591
 
592
592
  Get the profile picture for a WhatsApp channel or chat by ID.
593
593
 
594
- e.g., [unavatar.io/whatsapp/channel:0029VaARuQ7KwqSXh9fiMc0m](https://unavatar.io/whatsapp/channel:0029VaARuQ7KwqSXh9fiMc0m)
594
+ e.g., [unavatar.io/whatsapp/phone:34660021551](https://unavatar.io/whatsapp/phone:34660021551)
595
595
 
596
596
  The input supports a URI format `type:id`.
597
597
 
598
+ If no type is provided, the input is treated as a phone number.
599
+
598
600
  Available URI format inputs:
599
601
 
602
+ - `phone`: [unavatar.io/whatsapp/phone:34660021551](https://unavatar.io/whatsapp/phone:34660021551)
600
603
  - `channel`: [unavatar.io/whatsapp/channel:0029VaARuQ7KwqSXh9fiMc0m](https://unavatar.io/whatsapp/channel:0029VaARuQ7KwqSXh9fiMc0m)
601
604
  - `chat`: [unavatar.io/whatsapp/chat:D2FFycjQXrEIKG8qQjbwZz](https://unavatar.io/whatsapp/chat:D2FFycjQXrEIKG8qQjbwZz)
602
605
 
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.18.0",
5
+ "version": "3.19.1",
6
6
  "main": "src/index.js",
7
7
  "exports": {
8
8
  ".": "./src/index.js",
@@ -36,6 +36,7 @@ const providersBy = {
36
36
  'twitch',
37
37
  'vimeo',
38
38
  'x',
39
+ 'xboxgamertag',
39
40
  'youtube'
40
41
  ],
41
42
  domain: ['microlink']
@@ -81,6 +82,7 @@ module.exports = ctx => {
81
82
  vimeo: require('./vimeo')(ctx),
82
83
  whatsapp: require('./whatsapp')(ctx),
83
84
  x: require('./x')(ctx),
85
+ xboxgamertag: require('./xboxgamertag')(ctx),
84
86
  youtube: require('./youtube')(ctx)
85
87
  }
86
88
 
@@ -0,0 +1,16 @@
1
+ 'use strict'
2
+
3
+ const getAvatarUrl = input =>
4
+ `https://xboxgamertag.com/search/${encodeURIComponent(input)}`
5
+
6
+ const ensureProtocol = url =>
7
+ typeof url === 'string' && url.startsWith('//') ? `https:${url}` : url
8
+
9
+ module.exports = ({ createHtmlProvider }) =>
10
+ createHtmlProvider({
11
+ name: 'xboxgamertag',
12
+ url: getAvatarUrl,
13
+ getter: $ => ensureProtocol($('.page-header .avatar img').attr('src'))
14
+ })
15
+
16
+ module.exports.getAvatarUrl = getAvatarUrl