@unavatar/core 3.7.54 → 3.7.55
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/util/html-provider.js +17 -13
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.7.
|
|
5
|
+
"version": "3.7.55",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": "./src/index.js",
|
|
@@ -72,22 +72,26 @@ module.exports = ({ PROXY_TIMEOUT, DEBUG_HTML_TO_FILE, getHTML }) => {
|
|
|
72
72
|
const getResult = async ($, statusCode, log, tier) => {
|
|
73
73
|
const result = getter($)
|
|
74
74
|
if (typeof result !== 'string' || result === '') {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
75
|
+
let htmlDebugInfo = {}
|
|
76
|
+
|
|
77
|
+
if (DEBUG_HTML_TO_FILE) {
|
|
78
|
+
const { html, ...info } = await getHtmlDebugInfo($)
|
|
79
|
+
const requestId = typeof res.getHeader === 'function'
|
|
80
|
+
? res.getHeader('x-request-id')
|
|
81
|
+
: undefined
|
|
82
|
+
const htmlFile = await writeHtmlDebugFile({
|
|
83
|
+
debugEnabled: true,
|
|
84
|
+
provider: name,
|
|
85
|
+
tier,
|
|
86
|
+
requestId,
|
|
87
|
+
html
|
|
88
|
+
}).catch(() => undefined)
|
|
89
|
+
htmlDebugInfo = { ...info, ...(htmlFile ? { htmlFile } : {}) }
|
|
90
|
+
}
|
|
86
91
|
|
|
87
92
|
log.error({
|
|
88
93
|
statusCode,
|
|
89
|
-
...htmlDebugInfo
|
|
90
|
-
...(htmlFile ? { htmlFile } : {})
|
|
94
|
+
...htmlDebugInfo
|
|
91
95
|
})
|
|
92
96
|
|
|
93
97
|
throw createEmptyProviderValueError({ provider: name, statusCode })
|