From cd90e25ee267ac616d7432067c3eba5ac699f391 Mon Sep 17 00:00:00 2001 From: Ralf Ertzinger Date: Fri, 28 Sep 2012 16:43:07 +0200 Subject: [PATCH] Youtube: Add new signature to download URLs --- videosite/YouTubeGrabber.pm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/videosite/YouTubeGrabber.pm b/videosite/YouTubeGrabber.pm index 14f1032..e611a1f 100644 --- a/videosite/YouTubeGrabber.pm +++ b/videosite/YouTubeGrabber.pm @@ -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; } -- 1.8.3.1