mirror of
https://github.com/reality/dbot.git
synced 2025-01-26 03:54:18 +01:00
Fixed YouTube video duration reporting
This commit is contained in:
parent
f7b83e98b7
commit
0f0877f27a
@ -30,13 +30,14 @@ 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) {
|
||||||
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];
|
||||||
} else {
|
} else {
|
||||||
var seconds =((time[1]%60 < 10) ? "0"+time[1]%60 : time[1]%60),
|
var seconds =((time[2]%60 < 10) ? "0"+time[2]%60 : time[2]%60),
|
||||||
minutes = 0;
|
minutes = 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user