update to p5-WWW-YouTube-Download 0.27 from maintainer Mikolaj

Kucharski, adds a pair of patches to unbreak it with latest youtube.
ok jasper@ no objection from sthen@
This commit is contained in:
landry 2011-07-31 18:09:57 +00:00
parent f5fa9db851
commit 3dd5080186
5 changed files with 77 additions and 12 deletions

View File

@ -1,9 +1,9 @@
# $OpenBSD: Makefile,v 1.1.1.1 2011/04/25 13:04:17 todd Exp $
# $OpenBSD: Makefile,v 1.2 2011/07/31 18:09:57 landry Exp $
COMMENT = simple YouTube interface for downloading videos
MODULES = cpan
DISTNAME = WWW-YouTube-Download-0.25
DISTNAME = WWW-YouTube-Download-0.27
CATEGORIES = www
MAINTAINER = Mikolaj Kucharski <mikolaj@kucharski.name>
@ -25,8 +25,4 @@ RUN_DEPENDS = www/p5-libwww \
converters/p5-JSON \
www/p5-HTML-Parser
post-extract:
find -d "${WRKDIST}" \
-type d -name PaxHeader -exec rm -rf "{}" \;
.include <bsd.port.mk>

View File

@ -1,5 +1,5 @@
MD5 (WWW-YouTube-Download-0.25.tar.gz) = UgUqbB7HlELHbxzITA++dA==
RMD160 (WWW-YouTube-Download-0.25.tar.gz) = zHboIL1aGQtTVt10IJAfBCVVK2E=
SHA1 (WWW-YouTube-Download-0.25.tar.gz) = fRtFJ0SdCxioddHqtpHMgJgKdj0=
SHA256 (WWW-YouTube-Download-0.25.tar.gz) = yKuFWa15eRJ130X838Tu8EnwSbH4A2KIhKGKAWNUuuQ=
SIZE (WWW-YouTube-Download-0.25.tar.gz) = 32739
MD5 (WWW-YouTube-Download-0.27.tar.gz) = v6mPBdn69BVobk9lhbQCEQ==
RMD160 (WWW-YouTube-Download-0.27.tar.gz) = KS4KG2t5SlwgDmVSO6m6eztE6O8=
SHA1 (WWW-YouTube-Download-0.27.tar.gz) = GXaKGt/y+SYlH+bEdhWHrJ8Ozow=
SHA256 (WWW-YouTube-Download-0.27.tar.gz) = QOwsdvSFb2dckA/yt1NRhwyJTbKu3e2OWCu9un4hnns=
SIZE (WWW-YouTube-Download-0.27.tar.gz) = 31418

View File

@ -1,8 +1,8 @@
$OpenBSD: patch-Makefile_PL,v 1.2 2011/07/31 18:09:57 landry Exp $
Module::Install::AuthorTests is missing in ports tree,
but not really essential.
$OpenBSD: patch-Makefile_PL,v 1.1.1.1 2011/04/25 13:04:17 todd Exp $
--- Makefile.PL.orig Tue Jan 4 15:17:14 2011
+++ Makefile.PL Mon Jan 10 22:22:02 2011
@@ -8,7 +8,6 @@ requires 'JSON';

View File

@ -0,0 +1,46 @@
$OpenBSD: patch-lib_WWW_YouTube_Download_pm,v 1.1 2011/07/31 18:09:57 landry Exp $
- unbreak after recent youtube changes
- error out when extracting JSON fails
- support for another url type
- youtu.be shortener support
--- lib/WWW/YouTube/Download.pm.orig Sun May 29 15:32:20 2011
+++ lib/WWW/YouTube/Download.pm Sat Jul 30 22:44:24 2011
@@ -170,9 +170,17 @@ sub _get_args {
$data = JSON->new->utf8(1)->decode($json);
last;
}
+ elsif ($_ && /^\s*'PLAYER_CONFIG'\s*:\s*({.*})\s*$/) {
+ $data = JSON->new->utf8(1)->decode($1);
+ last;
+ }
}
- return $data->{args};
+ if ($data->{args}) {
+ return $data->{args};
+ } else {
+ Carp::croak "failed to extract JSON data.";
+ }
}
sub _parse_fmt_url_map {
@@ -214,13 +222,16 @@ sub _suffix {
sub _video_id {
my $stuff = shift;
- if ($stuff =~ m{/.*?[?&;]v=([^&#?=/;]+)}) {
+ if ($stuff =~ m{/.*?[?&;!]v=([^&#?=/;]+)}) {
return $1;
}
elsif ($stuff =~ m{/(?:e|v|embed)/([^&#?=/;]+)}) {
return $1;
}
elsif ($stuff =~ m{#p/(?:u|search)/\d+/([^&?/]+)}) {
+ return $1;
+ }
+ elsif ($stuff =~ m{youtu.be/([^&#?=/;]+)}) {
return $1;
}
else {

View File

@ -0,0 +1,23 @@
$OpenBSD: patch-t_private_video_id_t,v 1.1 2011/07/31 18:09:57 landry Exp $
- support for another url type
- youtu.be shortener support
--- t/private/video_id.t.orig Tue Apr 19 17:34:24 2011
+++ t/private/video_id.t Sat Jul 30 22:46:10 2011
@@ -73,5 +73,15 @@ test_video_id(
'INsSU8Jnx-4',
);
+test_video_id(
+ 'http://www.youtube.com/watch#!v=fqNKwF18cq0',
+ 'fqNKwF18cq0',
+);
+
+test_video_id(
+ 'youtu.be/HyNh3AXegxw',
+ 'HyNh3AXegxw',
+);
+
done_testing;