youtube debug output

This commit is contained in:
reality 2013-08-05 22:11:25 +00:00
parent e9c6729894
commit 99eb1462ad
2 changed files with 4 additions and 0 deletions

View File

@ -64,6 +64,7 @@ var link = function(dbot) {
for(var i=0;i<this.handlers.length;i++) { for(var i=0;i<this.handlers.length;i++) {
var matches = this.handlers[i].regex.exec(link); var matches = this.handlers[i].regex.exec(link);
if(matches) { if(matches) {
console.log(this.handlers[i].name);
handler = this.handlers[i]; handler = this.handlers[i];
break; break;
} }
@ -147,6 +148,7 @@ var link = function(dbot) {
var urlMatches = event.message.match(this.urlRegex); var urlMatches = event.message.match(this.urlRegex);
if(urlMatches !== null) { if(urlMatches !== null) {
this.links[event.channel.name] = urlMatches[0]; this.links[event.channel.name] = urlMatches[0];
console.log('DEBUG: got a link');
if(this.config.autoTitle == true) { if(this.config.autoTitle == true) {
this.api.parseLink(urlMatches[0], function(result) { this.api.parseLink(urlMatches[0], function(result) {
event.reply(result); event.reply(result);

View File

@ -53,10 +53,12 @@ var youtube = function(dbot) {
this.onLoad = function() { this.onLoad = function() {
dbot.api.link.addHandler(this.name, this.LinkRegex, dbot.api.link.addHandler(this.name, this.LinkRegex,
function(match, name, callback) { function(match, name, callback) {
console.log('DEBUG: well it got to the callback');
request.get(this.ApiRoot + '/videos/' + match[2], { request.get(this.ApiRoot + '/videos/' + match[2], {
'qs': this.params, 'qs': this.params,
'json': true 'json': true
}, function(error, response, body) { }, function(error, response, body) {
console.log('DEBUG: well it got to the callback of the callback');
if(_.isObject(body) && _.has(body, 'entry')) { if(_.isObject(body) && _.has(body, 'entry')) {
var v = body.entry; var v = body.entry;
if(!_.has(v, 'yt$rating')) { if(!_.has(v, 'yt$rating')) {