/usr/share/doc/libwww-youtube-download-perl/examples/cb.pl is in libwww-youtube-download-perl 0.56-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | use strict;
use warnings;
use WWW::YouTube::Download;
my $video_id = shift || die "Usage: $0 [video_id|video_url]";
my $client = WWW::YouTube::Download->new;
$client->download($video_id, { cb => \&cb, fmt => 18 });
my $fh;
sub cb {
my ($data, $res, $proto) = @_;
unless ($fh) {
open $fh, '>', "$video_id.mp4" or die "$video_id.mp4", " $!";
binmode $fh;
}
print $fh $data;
}
|