Improve youtube matching, fix google service name
This commit is contained in:
parent
e97db5b9e2
commit
a2f95a98b2
2 changed files with 3 additions and 4 deletions
|
@ -122,7 +122,7 @@ module.exports.search = function(data) {
|
||||||
}
|
}
|
||||||
return module.exports.search(cleanedData);
|
return module.exports.search(cleanedData);
|
||||||
} else {
|
} else {
|
||||||
return {service: "googleplaymusic"};
|
return {service: "google"};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var result = result.entries.filter(function(result) {
|
var result = result.entries.filter(function(result) {
|
||||||
|
|
|
@ -45,7 +45,7 @@ module.exports.lookupId = function(id, type) {
|
||||||
var promises = [];
|
var promises = [];
|
||||||
item.topicDetails.topicIds.forEach(function(topicId) {
|
item.topicDetails.topicIds.forEach(function(topicId) {
|
||||||
promises.push(freebase.get(topicId).then(function(topic) {
|
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) {
|
}, function(err) {
|
||||||
console.log(err)
|
console.log(err)
|
||||||
}));
|
}));
|
||||||
|
@ -54,12 +54,11 @@ module.exports.lookupId = function(id, type) {
|
||||||
for (var key in topics) {
|
for (var key in topics) {
|
||||||
var topic = topics[key];
|
var topic = topics[key];
|
||||||
if (topic) {
|
if (topic) {
|
||||||
console.log(topic.property['/music/recording/song'])
|
|
||||||
return {
|
return {
|
||||||
id: id,
|
id: id,
|
||||||
service: "youtube",
|
service: "youtube",
|
||||||
type: "track",
|
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},
|
artist: {name: topic.property['/music/recording/artist'].values[0].text},
|
||||||
album: {name: ""},
|
album: {name: ""},
|
||||||
streamUrl: "https://youtu.be/" + id,
|
streamUrl: "https://youtu.be/" + id,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue