This is an automated email from the git hooks/post-receive script. gregoa pushed a commit to branch master in repository libwww-youtube-download-perl.
commit c1766b128253979c07500301a13ca226b458fc82 Author: gregor herrmann <gre...@debian.org> Date: Sun Mar 8 15:24:40 2015 +0100 Add 2 small patches from Github to adjust to YouTube changes. Patches are taken from PR#31 in issue #27 at https://github.com/xaicron/p5-www-youtube-download/issues/27 Closes: #779985 --- .../Dont_fail_if_we_can't_find_a_signature.patch | 27 ++++++++++++++++++++++ ...arser_stop_when_it_finds_trailing_garbage.patch | 21 +++++++++++++++++ debian/patches/series | 2 ++ 3 files changed, 50 insertions(+) diff --git a/debian/patches/Dont_fail_if_we_can't_find_a_signature.patch b/debian/patches/Dont_fail_if_we_can't_find_a_signature.patch new file mode 100644 index 0000000..8e468f6 --- /dev/null +++ b/debian/patches/Dont_fail_if_we_can't_find_a_signature.patch @@ -0,0 +1,27 @@ +From 87a6a56829a2a7265953b56dbc8f55d8384367a1 Mon Sep 17 00:00:00 2001 +From: Thomas Sibley <tsib...@cpan.org> +Date: Sat, 23 Aug 2014 14:11:55 -0700 +Subject: [PATCH] Don't fail if we can't find a signature + +YouTube started offering pre-signed URLs, so at least give it a go if we +can't parse out a signature. This preserves the previous behaviour for +backwards compat if there are still older videos without pre-signed URLs +(unclear if that's so). +--- + lib/WWW/YouTube/Download.pm | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/lib/WWW/YouTube/Download.pm ++++ b/lib/WWW/YouTube/Download.pm +@@ -299,9 +299,9 @@ + my $uri = URI->new; + $uri->query($stuff); + my $query = +{ $uri->query_form }; +- my $sig = $query->{sig} || _getsig($query->{s}); ++ my $sig = $query->{sig} || ($query->{s} ? _getsig($query->{s}) : undef); + my $url = $query->{url}; +- $fmt_url_map->{$query->{itag}} = $url.'&signature='.$sig; ++ $fmt_url_map->{$query->{itag}} = $url . ($sig ? '&signature='.$sig : ''); + } + + return $fmt_url_map; diff --git a/debian/patches/Let_the_JSON_parser_stop_when_it_finds_trailing_garbage.patch b/debian/patches/Let_the_JSON_parser_stop_when_it_finds_trailing_garbage.patch new file mode 100644 index 0000000..9a2f87e --- /dev/null +++ b/debian/patches/Let_the_JSON_parser_stop_when_it_finds_trailing_garbage.patch @@ -0,0 +1,21 @@ +From dd7f116d09142a921dea266b99c9065ca6ae394d Mon Sep 17 00:00:00 2001 +From: Thomas Sibley <tsib...@cpan.org> +Date: Sat, 23 Aug 2014 14:11:14 -0700 +Subject: [PATCH] Let the JSON parser stop when it finds trailing garbage + +This is more robust than playing cat-and-mouse with the regex. +--- + lib/WWW/YouTube/Download.pm | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/lib/WWW/YouTube/Download.pm ++++ b/lib/WWW/YouTube/Download.pm +@@ -223,7 +223,7 @@ + croak 'Video not available in your country'; + } + elsif ($line =~ /^.+ytplayer\.config\s*=\s*({.*})/) { +- $data = JSON->new->utf8(1)->decode($1); ++ ($data, undef) = JSON->new->utf8(1)->decode_prefix($1); + last; + } + } diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000..7e12fe0 --- /dev/null +++ b/debian/patches/series @@ -0,0 +1,2 @@ +Let_the_JSON_parser_stop_when_it_finds_trailing_garbage.patch +Dont_fail_if_we_can't_find_a_signature.patch -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libwww-youtube-download-perl.git _______________________________________________ Pkg-perl-cvs-commits mailing list Pkg-perl-cvs-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits