Quick fix for Brett's report also attached in diff inlined below. Will work with upstream about this, however no reply from him for more than a week now.
Please test. Ok? Also, I'll think to extend the cli tool to list supported formats of given video_id. On Thu, Sep 27, 2012 at 09:48:30PM +0100, Mikolaj Kucharski wrote: > Hi Brett, > > On Mon, Sep 24, 2012 at 10:53:32AM +1000, Brett wrote: > > > Fixes the port after changes on the site. Sent to the upstream few days > > > ago, no reply yet, so sending here. > > > > > > Ok? > > > > This works for me, except the --fmt option does not work, all videos are > > downloaded in flv format. (I am assuming that formats should be specified > > as a 2 digit number, like shown here: > > https://en.wikipedia.org/wiki/YouTube#Quality_and_codecs - its not in the > > man page how they should be specified). > > > > Brett. > > > > Thanks for spotting this. Looking into this now. Can you confirm that > only suffix is wrong but downloaded movie size changes and content > changes too (file *.flv)? > Index: Makefile =================================================================== RCS file: /cvs/ports/www/p5-WWW-YouTube-Download/Makefile,v retrieving revision 1.5 diff -u -r1.5 Makefile --- Makefile 24 Jan 2012 00:44:47 -0000 1.5 +++ Makefile 27 Sep 2012 22:05:56 -0000 @@ -4,6 +4,7 @@ MODULES = cpan DISTNAME = WWW-YouTube-Download-0.40 +REVISION = 0 CATEGORIES = www MAINTAINER = Mikolaj Kucharski <miko...@kucharski.name> Index: patches/patch-bin_youtube-download =================================================================== RCS file: patches/patch-bin_youtube-download diff -N patches/patch-bin_youtube-download --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-bin_youtube-download 27 Sep 2012 22:05:56 -0000 @@ -0,0 +1,15 @@ +$OpenBSD$ + +- fix for proper suffix support in downloaded filename + +--- bin/youtube-download.orig Tue Jan 17 16:22:02 2012 ++++ bin/youtube-download Thu Sep 27 22:42:51 2012 +@@ -47,7 +47,7 @@ main: { + my $filename = $client->_format_filename($output, { + video_id => $meta_data->{video_id}, + title => decode_utf8($meta_data->{title}), +- suffix => $meta_data->{suffix}, ++ suffix => $fmt ? $meta_data->{video_url_map}{$fmt}{suffix} : $meta_data->{suffix}, + }); + $filename = filename_normalize($filename); + $filename = $encoder->encode($filename, sub { sprintf 'U+%x', shift }); Index: patches/patch-lib_WWW_YouTube_Download_pm =================================================================== RCS file: patches/patch-lib_WWW_YouTube_Download_pm diff -N patches/patch-lib_WWW_YouTube_Download_pm --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-lib_WWW_YouTube_Download_pm 27 Sep 2012 22:05:56 -0000 @@ -0,0 +1,17 @@ +$OpenBSD$ + +- fix downloading after youtube changes + +--- lib/WWW/YouTube/Download.pm.orig Sun Jan 22 07:54:47 2012 ++++ lib/WWW/YouTube/Download.pm Thu Sep 27 22:45:08 2012 +@@ -222,7 +222,9 @@ sub _parse_stream_map { + my $uri = URI->new; + $uri->query($stuff); + my $query = +{ $uri->query_form }; +- $fmt_url_map->{$query->{itag}} = $query->{url}; ++ my $sig = $query->{sig}; ++ my $url = $query->{url}; ++ $fmt_url_map->{$query->{itag}} = $url.'&signature='.$sig; + } + + return $fmt_url_map; -- best regards q#