main: Add URL shorteners hel.me, 7ax.de and ow.ly
[videosite.git] / videosite / YouTubeGrabber.pm
index 86b21bd..b489130 100644 (file)
@@ -61,10 +61,20 @@ sub _parse {
     my $videourl;
     my $quality = $self->_getval('QUALITY');
     my %preflist = (
-        'hd' => [37, 22, 35, 18, 34, 6, 5],
-        'h264' => [18, 34, 37, 22, 35, 6, 5],
-        'high' => [34, 35, 18, 37, 22, 6, 5],
-        'normal' => [6, 5, 34, 35, 18, 22, 37]);
+        'insane' => [38, 37, 22, 35, 18, 34, 6, 5],
+        'hd' => [37, 22, 35, 18, 34, 6, 5, 38],
+        'h264' => [18, 34, 37, 22, 35, 6, 5, 38],
+        'high' => [34, 35, 18, 37, 22, 6, 5, 38],
+        'normal' => [6, 5, 34, 35, 18, 22, 37, 38]);
+    my %videoformats = (
+        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',
+        );
     my $preflist;
     my $jsp;
 
@@ -185,20 +195,10 @@ sub _parse {
 
             if (%urls) {
                 foreach (keys(%urls)) {
-                    if ($_ == 35) {
-                        $self->debug('Found flv,h264,large: %s', $urls{$_});
-                    } elsif ($_ == 34) {
-                        $self->debug('Found flv,h264: %s', $urls{$_});
-                    } elsif ($_ == 22) {
-                        $self->debug('Found mp4,h264,720p: %s', $urls{$_});
-                    } elsif ($_ == 37) {
-                        $self->debug('Found mp4,h264,1080p: %s', $urls{$_});
-                    } elsif ($_ == 18) {
-                        $self->debug('Found mp4,h264: %s', $urls{$_});
-                    } elsif ($_ == 5) {
-                        $self->debug('Found flv,flv: %s', $urls{$_});
+                    if (exists($videoformats{$_})) {
+                        $self->debug('Found URL for format %s (%s): %s', $_, $videoformats{$_}, $urls{$_});
                     } else {
-                        $self->error('Unknown tag %s: %s', $_, $urls{$_});
+                        $self->error('Unknown format %s: %s', $_, $urls{$_});
                     }
                 }