diff --git a/lib/services/google/index.js b/lib/services/google/index.js index e5ece8d..a453239 100644 --- a/lib/services/google/index.js +++ b/lib/services/google/index.js @@ -122,7 +122,7 @@ module.exports.search = function(data) { } return module.exports.search(cleanedData); } else { - return {service: "googleplaymusic"}; + return {service: "google"}; } } var result = result.entries.filter(function(result) { diff --git a/lib/services/youtube/index.js b/lib/services/youtube/index.js index 63746af..e58939c 100644 --- a/lib/services/youtube/index.js +++ b/lib/services/youtube/index.js @@ -45,7 +45,7 @@ module.exports.lookupId = function(id, type) { var promises = []; item.topicDetails.topicIds.forEach(function(topicId) { promises.push(freebase.get(topicId).then(function(topic) { - return topic.property["/music/recording/song"] ? topic : false; + return (topic.property["/music/recording/song"] ? topic : (topic.property["/music/recording/tracks"] ? topic : false)); }, function(err) { console.log(err) })); @@ -54,12 +54,11 @@ module.exports.lookupId = function(id, type) { for (var key in topics) { var topic = topics[key]; if (topic) { - console.log(topic.property['/music/recording/song']) return { id: id, service: "youtube", type: "track", - name: topic.property['/music/recording/song'].values[0].text, + name: topic.property['/music/recording/song'] ? topic.property['/music/recording/song'].values[0].text : topic.property["/music/recording/tracks"].values[0].text, artist: {name: topic.property['/music/recording/artist'].values[0].text}, album: {name: ""}, streamUrl: "https://youtu.be/" + id,