@unavatar/core 3.51.0 → 3.52.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 +7 -0
- package/package.json +1 -1
- package/src/providers/index.js +2 -0
- package/src/providers/keybase.js +25 -0
package/README.md
CHANGED
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
- [Hugging Face](#hugging-face)
|
|
52
52
|
- [Instagram](#instagram)
|
|
53
53
|
- [Juejin](#juejin)
|
|
54
|
+
- [Keybase](#keybase)
|
|
54
55
|
- [Kick](#kick)
|
|
55
56
|
- [Ko-fi](#ko-fi)
|
|
56
57
|
- [LinkedIn](#linkedin)
|
|
@@ -831,6 +832,12 @@ Get any Juejin user's profile picture by their numeric user ID.
|
|
|
831
832
|
|
|
832
833
|
e.g., [unavatar.io/juejin/1556564194374926](https://unavatar.io/juejin/1556564194374926)
|
|
833
834
|
|
|
835
|
+
### Keybase
|
|
836
|
+
|
|
837
|
+
Get any Keybase user's profile picture by their username.
|
|
838
|
+
|
|
839
|
+
e.g., [unavatar.io/keybase/chris](https://unavatar.io/keybase/chris)
|
|
840
|
+
|
|
834
841
|
### Kick
|
|
835
842
|
|
|
836
843
|
Get any Kick streamer'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.
|
|
5
|
+
"version": "3.52.0",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": "./src/index.js",
|
package/src/providers/index.js
CHANGED
|
@@ -31,6 +31,7 @@ const providerTiers = {
|
|
|
31
31
|
'hevy',
|
|
32
32
|
'instagram',
|
|
33
33
|
'juejin',
|
|
34
|
+
'keybase',
|
|
34
35
|
'kick',
|
|
35
36
|
'ko-fi',
|
|
36
37
|
'linkedin',
|
|
@@ -123,6 +124,7 @@ module.exports = ctx => {
|
|
|
123
124
|
hevy: require('./hevy')(ctx),
|
|
124
125
|
instagram: require('./instagram')(ctx),
|
|
125
126
|
juejin: require('./juejin')(ctx),
|
|
127
|
+
keybase: require('./keybase')(ctx),
|
|
126
128
|
kick: require('./kick')(ctx),
|
|
127
129
|
'ko-fi': require('./ko-fi')(ctx),
|
|
128
130
|
linkedin: require('./linkedin')(ctx),
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const stringify = require('../util/stringify')
|
|
4
|
+
|
|
5
|
+
const API_URL = 'https://keybase.io/_/api/1.0/user/lookup.json'
|
|
6
|
+
|
|
7
|
+
const getAvatarUrl = input =>
|
|
8
|
+
`${API_URL}?${stringify({ username: input, fields: 'pictures' })}`
|
|
9
|
+
|
|
10
|
+
const getAvatar = body => body?.them?.pictures?.primary?.url || undefined
|
|
11
|
+
|
|
12
|
+
module.exports = ({ got }) =>
|
|
13
|
+
async function keybase (input) {
|
|
14
|
+
const { body, statusCode } = await got(getAvatarUrl(input), {
|
|
15
|
+
responseType: 'json',
|
|
16
|
+
throwHttpErrors: false
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
if (statusCode >= 400) return
|
|
20
|
+
|
|
21
|
+
return getAvatar(body)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
module.exports.getAvatarUrl = getAvatarUrl
|
|
25
|
+
module.exports.getAvatar = getAvatar
|