This commit is contained in:
reality 2015-05-29 17:26:04 +00:00
parent aba5ac4fa5
commit 2483ec1ef6

View File

@ -29,6 +29,7 @@ var youtube = function(dbot) {
this.internalAPI = { this.internalAPI = {
'formatLink': function(v) { 'formatLink': function(v) {
var time = v.contentDetails.duration.match(/^PT(\d+)?M?(\d+)S$/); var time = v.contentDetails.duration.match(/^PT(\d+)?M?(\d+)S$/);
if(time) {
if(time[1]) { if(time[1]) {
var seconds =((time[2]%60 < 10) ? "0"+time[2]%60 : time[2]%60), var seconds =((time[2]%60 < 10) ? "0"+time[2]%60 : time[2]%60),
minutes = time[1]; minutes = time[1];
@ -36,6 +37,11 @@ var youtube = function(dbot) {
var seconds =((time[1]%60 < 10) ? "0"+time[1]%60 : time[1]%60), var seconds =((time[1]%60 < 10) ? "0"+time[1]%60 : time[1]%60),
minutes = 0; minutes = 0;
} }
} else {
minutes = 'id';
seconds = 'fk';
console.log(v.contentDetails.duration);
}
var res = dbot.t('yt_video', { var res = dbot.t('yt_video', {
'title': v.snippet.title, 'title': v.snippet.title,