spotify-url-info
Advanced tools
Comparing version 3.1.8 to 3.1.9
@@ -5,3 +5,3 @@ { | ||
"homepage": "https://github.com/microlinkhq/spotify-url-info", | ||
"version": "3.1.8", | ||
"version": "3.1.9", | ||
"main": "src/index.js", | ||
@@ -8,0 +8,0 @@ "author": { |
@@ -14,2 +14,13 @@ 'use strict' | ||
const ERROR = { | ||
REPORT: | ||
'Please report the problem at https://github.com/microlinkhq/spotify-url-info/issues.', | ||
NOT_DATA: "Couldn't find any data in embed page that we know how to parse.", | ||
NOT_SCRIPTS: "Couldn't find scripts to get the data." | ||
} | ||
const throwError = message => { | ||
throw new TypeError(`${message}\n${ERROR.REPORT}`) | ||
} | ||
const SUPPORTED_TYPES = Object.values(TYPE) | ||
@@ -25,5 +36,8 @@ | ||
const scripts = embed | ||
.find(el => el.tagName === 'html') | ||
.children.find(el => el.tagName === 'body') | ||
let scripts = embed.find(el => el.tagName === 'html') | ||
if (scripts === undefined) return throwError(ERROR.NOT_SCRIPTS) | ||
scripts = scripts.children | ||
.find(el => el.tagName === 'body') | ||
.children.filter(({ tagName }) => tagName === 'script') | ||
@@ -53,5 +67,3 @@ | ||
throw new Error( | ||
"Couldn't find any data in embed page that we know how to parse.\nPlease report the problem at https://github.com/microlinkhq/spotify-url-info/issues." | ||
) | ||
return throwError(ERROR.NOT_DATA) | ||
} | ||
@@ -58,0 +70,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13399
227