3
0
mirror of https://github.com/reality/dbot.git synced 2024-11-27 14:29:29 +01:00
This commit is contained in:
reality 2015-05-29 17:26:04 +00:00
parent aba5ac4fa5
commit 2483ec1ef6

View File

@ -29,12 +29,18 @@ 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[1]) { if(time) {
var seconds =((time[2]%60 < 10) ? "0"+time[2]%60 : time[2]%60), if(time[1]) {
minutes = 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 { } else {
var seconds =((time[1]%60 < 10) ? "0"+time[1]%60 : time[1]%60), minutes = 'id';
minutes = 0; seconds = 'fk';
console.log(v.contentDetails.duration);
} }
var res = dbot.t('yt_video', { var res = dbot.t('yt_video', {