mirror of
https://github.com/reality/dbot.git
synced 2024-12-26 12:42:51 +01:00
fix youtube stuff
This commit is contained in:
parent
ac2a6036eb
commit
81cfa22dcf
@ -221,11 +221,10 @@ 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, 'feed') && _.has(body.feed, 'entry')) {
|
if(_.isObject(body) && _.has(body, 'items') && body.items.length > 0) {
|
||||||
var v = body.feed.entry[0];
|
var link = body.items[0].id
|
||||||
link = v.link[0].href.match(dbot.modules.youtube.LinkRegex);
|
|
||||||
if(link) {
|
if(link) {
|
||||||
output += ' - http://youtu.be/' + link[2];
|
output += ' - http://youtu.be/' + link;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
event.reply(output);
|
event.reply(output);
|
||||||
@ -274,11 +273,10 @@ var lastfm = function(dbot) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
dbot.api.youtube.search(term, function(body) {
|
dbot.api.youtube.search(term, function(body) {
|
||||||
if(_.isObject(body) && _.has(body, 'feed') && _.has(body.feed, 'entry')) {
|
if(_.isObject(body) && _.has(body, 'items') && body.items.length > 0) {
|
||||||
var v = body.feed.entry[0];
|
var link = body.items[0].id
|
||||||
link = v.link[0].href.match(dbot.modules.youtube.LinkRegex);
|
|
||||||
if(link) {
|
if(link) {
|
||||||
output += ' - http://youtu.be/' + link[2];
|
output += ' - http://youtu.be/' + link;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
event.reply(output);
|
event.reply(output);
|
||||||
|
Loading…
Reference in New Issue
Block a user