Explorar o código

Parse durations for longer videos

Zachary Kotlarek %!s(int64=11) %!d(string=hai) anos
pai
achega
c8bb503904
Modificáronse 1 ficheiros con 3 adicións e 1 borrados
  1. 3 1
      yt/subscribe.pl

+ 3 - 1
yt/subscribe.pl

@@ -1013,7 +1013,9 @@ sub calcVideoData($) {
 	} else {
 		$video->{'season'} = 0;
 	}
-	if ($video->{'rawDuration'} =~ /PT(\d+)M(\d+)S/) {
+	if ($video->{'rawDuration'} =~ /PT(\d+)H(\d+)M(\d+)S/) {
+		$video->{'duration'} = ($1 * 3600) + ($2 * 60) + $2;
+	} elsif ($video->{'rawDuration'} =~ /PT(\d+)M(\d+)S/) {
 		$video->{'duration'} = ($1 * 60) + $2;
 	} elsif ($video->{'rawDuration'} =~ /PT(\d+)S/) {
 		$video->{'duration'} = $1;