From 2483ec1ef6d455f3344c4ba1cf33779e0fe0f333 Mon Sep 17 00:00:00 2001 From: reality Date: Fri, 29 May 2015 17:26:04 +0000 Subject: [PATCH] idk --- modules/youtube/youtube.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/modules/youtube/youtube.js b/modules/youtube/youtube.js index 17ebb80..0bd73d9 100644 --- a/modules/youtube/youtube.js +++ b/modules/youtube/youtube.js @@ -29,12 +29,18 @@ var youtube = function(dbot) { this.internalAPI = { 'formatLink': function(v) { var time = v.contentDetails.duration.match(/^PT(\d+)?M?(\d+)S$/); - if(time[1]) { - var seconds =((time[2]%60 < 10) ? "0"+time[2]%60 : time[2]%60), - minutes = time[1]; + if(time) { + if(time[1]) { + var seconds =((time[2]%60 < 10) ? "0"+time[2]%60 : time[2]%60), + minutes = time[1]; + } else { + var seconds =((time[1]%60 < 10) ? "0"+time[1]%60 : time[1]%60), + minutes = 0; + } } else { - var seconds =((time[1]%60 < 10) ? "0"+time[1]%60 : time[1]%60), - minutes = 0; + minutes = 'id'; + seconds = 'fk'; + console.log(v.contentDetails.duration); } var res = dbot.t('yt_video', {