YouTube: Add comment to format list
[videosite.git] / videosite / YouTubeGrabber.pm
index fd3e0c0..ede2dcc 100644 (file)
@@ -26,16 +26,17 @@ my %preflist = (
     'high' => [34, 35, 18, 37, 22, 6, 5, 38, 43],
     'normal' => [6, 5, 34, 35, 18, 22, 37, 38, 43]);
 my %videoformats = (
-    43 => 'webm,360p',
-    44 => 'webm,480p',
-    45 => 'webm,720p',
-    38 => 'mp4,h264,4k',
-    37 => 'mp4,h264,1080p',
-    35 => 'flv,h264,large',
-    34 => 'flv,h264',
-    22 => 'mp4,h264,720p',
-    18 => 'mp4,h264',
-    5 => 'flv,flv',
+    # Container/Video codec/Audio codec/Resolution
+    5 => 'FLV/Sorenson/MP3/240p',
+    18 => 'MP4/H264/AAC/360p',
+    22 => 'MP4/H264/AAC/720p',
+    34 => 'FLV/H264/AAC/360p',
+    35 => 'FLV/H264/AAC/480p',
+    37 => 'MP4/H264/AAC/1080p',
+    38 => 'MP4/H264/AAC/3072p',
+    43 => 'WebM/VP8/Vorbis/360p',
+    44 => 'WebM/VP8/Vorbis/480p',
+    45 => 'WebM/VP8/Vorbis/720p',
     );
 
 sub new {
@@ -139,7 +140,7 @@ sub _parse_by_video_info {
         $urls = $self->decode_hexurl($content->{'fmt_url_map'});
         $urls = { split /[\|,]/, $urls };
     } elsif (exists($content->{'url_encoded_fmt_stream_map'})) {
-        $urls = $self->_decode_url_encoded_fmt_stream_map($content->{'url_encoded_fmt_stream_map'});
+        $urls = $self->_decode_url_encoded_fmt_stream_map($content->{'url_encoded_fmt_stream_map'}, 1);
     } else {
         $self->debug("No URL data found");
         return undef;
@@ -467,7 +468,7 @@ sub _decode_url_encoded_fmt_stream_map {
     my $dataencoded = shift;
     my @data;
 
-    $data = $self->decode_hexurl($data) if (defined($dataencoded) && $dataencoded);
+    $data = $self->decode_hexurl($data) if $dataencoded;
     # This will
     # - Split the decoded string into segments (along ,)
     # - Interpret each segment as a concatenated key-value list (key and value separated by =, pairs separated by &