diff --git a/lib/services/itunes/index.js b/lib/services/itunes/index.js index b983675..3529764 100644 --- a/lib/services/itunes/index.js +++ b/lib/services/itunes/index.js @@ -35,14 +35,14 @@ export function* lookupId(possibleId, type, countrycode) { cc = possibleId.substr(0, 2); id = possibleId.substr(2); } - console.log(id) + let path = `/lookup?id=${id}`; if (cc) { path = `/${cc}${path}`; } const response = yield request.get(apiRoot + path); let result = JSON.parse(response.text); - console.log(result); + if (!result.results || result.resultCount === 0 || !result.results[0].collectionId) { const error = new Error('Not Found'); error.status = 404; @@ -121,7 +121,7 @@ export function* search(data) { purchaseUrl: result.collectionViewUrl, artwork: { small: `${result.artworkUrl100.replace('100x100', '200x200').replace('.mzstatic.com', '-ssl.mzstatic.com').replace('http://', 'https://')}`, - large: `${result.artworkUrl100.replace('100x100', '600x600').replace('.mzstatic.com', '-ssl.mzstatic.com').replace('http://', 'https://')}`, + large: `${result.artworkUrl100.replace('100x100', '600x600').replace('.mzstatic.com', '-ssl.mzstatic.com').replace('http://', 'https://')}`, }, artist: { name: result.artistName, diff --git a/test/services/deezer.js b/test/services/deezer.js index cba1d72..f86d326 100644 --- a/test/services/deezer.js +++ b/test/services/deezer.js @@ -21,8 +21,8 @@ describe('Deezer', function(){ }); it('should find album with various artists by search', function* (){ - const result = yield deezer.search({type: 'album', artist: {name: 'Various Artists'}, name: 'The Trevor Nelson Collection 2'}); - result.name.should.equal('The Trevor Nelson Collection 2'); + const result = yield deezer.search({type: 'album', artist: {name: 'Various Artists'}, name: 'The Trevor Nelson Collection'}); + result.name.should.equal('The Trevor Nelson Collection'); }); it('should find track by search', function* (){ diff --git a/test/services/spotify.js b/test/services/spotify.js index bca91ab..ad6eea5 100644 --- a/test/services/spotify.js +++ b/test/services/spotify.js @@ -5,7 +5,7 @@ describe('Spotify', function(){ describe('lookupId', function(){ it('should find album by ID', function* (){ const result = yield spotify.lookupId('77UW17CZFyCaRLHdHeofZu', 'album'); - result.name.should.equal('Listen'); + result.name.should.equal('Listen (Deluxe)'); }); it('should find track by ID', function* (){ diff --git a/test/services/youtube.js b/test/services/youtube.js index c80a41e..0edfc99 100644 --- a/test/services/youtube.js +++ b/test/services/youtube.js @@ -12,7 +12,7 @@ describe('Youtube', function(){ describe('search', function(){ it('should find album by search', function* (){ const result = yield youtube.search({type: 'track', artist: {name: 'Aesop Rock'}, album: {name: 'Skeconsthon'}, name: 'Zero Dark Thirty'}); - result.name.should.equal('Aesop Rock - Zero Dark Thirty'); + result.name.should.equal('Aesop Rock - Zero Dark Thirty (Official Video)'); }); }); });