@unavatar/core 3.45.2 → 3.45.4
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 +1 -1
- package/src/providers/dribbble.js +10 -1
- package/src/providers/index.js +0 -2
- package/src/providers/douban.js +0 -15
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.45.
|
|
5
|
+
"version": "3.45.4",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": "./src/index.js",
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
+
const uniqueRandomArray = require('unique-random-array')
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Dribbble answers 403 to crawler/bot user agents, so a real desktop
|
|
7
|
+
* browser user agent is required to reach the profile markup.
|
|
8
|
+
*/
|
|
9
|
+
const randomUserAgent = uniqueRandomArray(require('top-user-agents'))
|
|
10
|
+
|
|
3
11
|
module.exports = ({ createHtmlProvider }) =>
|
|
4
12
|
createHtmlProvider({
|
|
5
13
|
name: 'dribbble',
|
|
6
14
|
url: input => `https://dribbble.com/${input}`,
|
|
7
|
-
getter: $ => $('.profile-avatar').attr('src')
|
|
15
|
+
getter: $ => $('.profile-avatar').attr('src'),
|
|
16
|
+
htmlOpts: () => ({ headers: { 'user-agent': randomUserAgent() } })
|
|
8
17
|
})
|
package/src/providers/index.js
CHANGED
|
@@ -17,7 +17,6 @@ const providersBy = {
|
|
|
17
17
|
'deviantart',
|
|
18
18
|
'discord',
|
|
19
19
|
'dockerhub',
|
|
20
|
-
'douban',
|
|
21
20
|
'dribbble',
|
|
22
21
|
'facebook',
|
|
23
22
|
'flickr',
|
|
@@ -92,7 +91,6 @@ module.exports = ctx => {
|
|
|
92
91
|
deviantart: require('./deviantart')(ctx),
|
|
93
92
|
discord: require('./discord')(ctx),
|
|
94
93
|
dockerhub: require('./dockerhub')(ctx),
|
|
95
|
-
douban: require('./douban')(ctx),
|
|
96
94
|
dribbble: require('./dribbble')(ctx),
|
|
97
95
|
duckduckgo: require('./duckduckgo')(ctx),
|
|
98
96
|
facebook: require('./facebook')(ctx),
|
package/src/providers/douban.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const getAvatarUrl = input => `https://www.douban.com/people/${input}/`
|
|
4
|
-
|
|
5
|
-
const getAvatar = $ => $('img.userface').attr('src')
|
|
6
|
-
|
|
7
|
-
module.exports = ({ createHtmlProvider }) =>
|
|
8
|
-
createHtmlProvider({
|
|
9
|
-
name: 'douban',
|
|
10
|
-
url: getAvatarUrl,
|
|
11
|
-
getter: getAvatar
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
module.exports.getAvatarUrl = getAvatarUrl
|
|
15
|
-
module.exports.getAvatar = getAvatar
|