Youtube: Add support for adaptive video formats (split video/audio)
[videosite.git] / videosite / FileGetter.pm
index b2a0cea..48278dd 100644 (file)
@@ -60,6 +60,17 @@ sub get {
         return 0;
     }
 
+    if (exists($video->{'DLURL_AUDIO'})) {
+        $dlfile = $dlfile . ".audio";
+        $self->debug('Going to download %s to %s', $video->{'DLURL_AUDIO'}, $dlfile);
+
+        $res = $ua->mirror($video->{'DLURL_AUDIO'}, $dlfile);
+        if (!$res->is_success()) {
+            $self->error('Could not download %s to %s (%s)', $video->{'DLURL_AUDIO'}, $dlfile, $res->code());
+            return 0;
+        }
+    }
+
     return 1;
 }