#33 Fix issue #32 unescape crawled data

Merged
sayem314 merged 1 commits from saeedsheikhi/master into sayem314/master 4 år sedan
1 ändrade filer med 4 tillägg och 3 borttagningar
  1. 4 3
      src/downloadTypes/spotify.js

+ 4 - 3
src/downloadTypes/spotify.js

@@ -23,16 +23,17 @@ const getData = (type, id) => {
   return axios
     .get(embedURL)
     .then((res) => parse(res.data))
-    .then((data) =>
-      JSON.parse(
+    .then(
+      (data) =>
         data
           .filter((e) => e.tagName === 'html')[0]
           .children.filter((e) => e.tagName === 'body')[0]
           .children.filter(
             (e) => e.tagName === 'script' && e.attributes.findIndex((a) => a.value === 'resource') !== -1
           )[0].children[0].content
-      )
     )
+    .then((escapedData) => unescape(escapedData))
+    .then((data) => JSON.parse(data))
     .then(sanityCheck);
 };