From 49cf87d5c9382c8bdfe8f307b1bc36858959722f Mon Sep 17 00:00:00 2001 From: Jonathan Cremin Date: Fri, 5 Dec 2014 21:47:34 +0000 Subject: [PATCH] Fix itunes --- lib/services/itunes.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/services/itunes.js b/lib/services/itunes.js index 20cf8dd..4f4fd0a 100644 --- a/lib/services/itunes.js +++ b/lib/services/itunes.js @@ -68,9 +68,9 @@ module.exports.search = function(data) { var path = "/search?term=" + encodeURIComponent(query) + "&media=music&entity=" + entity; request.get(apiRoot + path, function(res) { - var data = JSON.parse(res.text); + var result = JSON.parse(res.text); - if (!data.results[0]) { + if (!result.results[0]) { var matches = album.match(/^[^\(\[]+/); if (matches[0]) { var cleanedData = JSON.parse(JSON.stringify(data)); @@ -84,7 +84,7 @@ module.exports.search = function(data) { deferred.resolve({service: "itunes"}); } } else { - var result = data.results[0]; + var result = result.results[0]; var item = { service: "itunes",