Youtube: Add new signature to download URLs
authorRalf Ertzinger <ralf@skytale.net>
Fri, 28 Sep 2012 14:43:07 +0000 (16:43 +0200)
committerRalf Ertzinger <ralf@skytale.net>
Fri, 28 Sep 2012 14:43:07 +0000 (16:43 +0200)
videosite/YouTubeGrabber.pm

index 14f1032..e611a1f 100644 (file)
@@ -449,6 +449,7 @@ sub _decode_url_encoded_fmt_stream_map {
     my $data = shift;
     my $dataencoded = shift;
     my @data;
+    my $h = {};
 
     $data = $self->decode_hexurl($data) if $dataencoded;
     # This will
@@ -464,7 +465,16 @@ sub _decode_url_encoded_fmt_stream_map {
     # From each array entry, pick the itag and the url values and return that
     # as a hash reference
     
-    return { map { $_->{'itag'}, $_->{'url'} } @data };
+
+    foreach (@data) {
+        if (exists($_->{'sig'})) {
+            $h->{$_->{'itag'}} = sprintf('%s&signature=%s', $_->{'url'}, $_->{'sig'});
+        } else {
+            $h->{$_->{'itag'}} =  $_->{'url'};
+        }
+    }
+
+    return $h;
 }