3
0
mirror of https://github.com/reality/dbot.git synced 2024-11-30 16:09:27 +01:00

fix youtube stuff

This commit is contained in:
reality 2015-04-27 09:23:27 +00:00
parent 613b9cd3bd
commit ea07d55b9e

View File

@ -222,7 +222,7 @@ var lastfm = function(dbot) {
var term = track.name + ' ' + track.artist.name; var term = track.name + ' ' + track.artist.name;
dbot.api.youtube.search(term, function(body) { dbot.api.youtube.search(term, function(body) {
if(_.isObject(body) && _.has(body, 'items') && body.items.length > 0) { if(_.isObject(body) && _.has(body, 'items') && body.items.length > 0) {
var link = body.items[0].id var link = body.items[0].id.videoId
if(link) { if(link) {
output += ' - http://youtu.be/' + link; output += ' - http://youtu.be/' + link;
} }
@ -274,7 +274,7 @@ var lastfm = function(dbot) {
} }
dbot.api.youtube.search(term, function(body) { dbot.api.youtube.search(term, function(body) {
if(_.isObject(body) && _.has(body, 'items') && body.items.length > 0) { if(_.isObject(body) && _.has(body, 'items') && body.items.length > 0) {
var link = body.items[0].id var link = body.items[0].id.videoId
if(link) { if(link) {
output += ' - http://youtu.be/' + link; output += ' - http://youtu.be/' + link;
} }