Branch Coverage

blib/lib/WWW/YouTube/Download.pm
Criterion Covered Total %
branch 29 182 15.9


line true false branch
29 32 0 unless exists $args{'ua'}
39 0 0 unless $video_id
47 0 0 unless $video_id
59 0 0 unless $video_id
82 0 0 defined $args->{'overwrite'} ? :
0 0 unless ref $args->{'cb'} eq 'CODE'
85 0 0 if $res->is_error
90 0 0 unless defined $filename
91 0 0 unless $data->{$1}
98 0 0 defined $data->{'video_url_map'}{$fmt}{'url'} ? :
104 0 0 unless (defined $args->{'_progress'})
105 0 0 unless eval 'require Term::ProgressBar'
107 0 0 $total > 50000000 ? :
120 0 0 if -f $file and not $overwrite
121 0 0 unless open my $wfh, '>', $file
124 0 0 if $verbose
129 0 0 if ($verbose or $self->{'verbose'})
133 0 0 if ($progress)
134 0 0 if (my $p = $self->_progress($args, $total)) { }
145 0 0 if $total == $size
152 0 1 unless $video_id
155 0 1 if ref $self->{'cache'}{$video_id} eq 'HASH'
159 1 0 if ($self->_is_new($content)) { }
203 0 0 $stype eq '3gp' ? :
2 0 $stype eq 'mp4' ? :
0 2 $stype eq 'webm' ? :
231 0 0 unless my($title) = $content =~ //
238 1 0 if ($content =~ m[
0 0 elsif ($content =~ /","author":"([^"]+)","/) { }
251 0 0 unless ($args->{'fmt_list'} and $args->{'url_encoded_fmt_stream_map'})
283 0 0 if $res->is_error
293 0 2 unless $line
294 0 2 if ($line =~ /the uploader has not made this video available in your country/i) { }
2 0 elsif ($line =~ /^.+ytplayer\.config\s*=\s*(\{.*})/) { }
303 0 2 unless $data->{'args'}
311 1 0 unless $args->{'fmt_list'} and $args->{'url_encoded_fmt_stream_map'}
330 0 0 if (@s == 93) { }
0 0 elsif (@s == 92) { }
0 0 elsif (@s == 91) { }
0 0 elsif (@s == 90) { }
0 0 elsif (@s == 89) { }
0 0 elsif (@s == 88) { }
0 0 elsif (@s == 87) { }
0 0 elsif (@s == 86) { }
0 0 elsif (@s == 85) { }
0 0 elsif (@s == 84) { }
0 0 elsif (@s == 83) { }
0 0 elsif (@s == 82) { }
0 0 elsif (@s == 81) { }
0 0 elsif (@s == 80) { }
0 0 elsif (@s == 79) { }
367 0 0 unless $sig
369 0 0 unless @sig
382 0 0 $sig ? :
390 0 0 unless $ua
391 0 0 unless eval { do { $ua->isa('LWP::UserAgent') } }
397 0 0 $fmt =~ /13|17/ ? :
0 0 $fmt =~ /18|22|37|38/ ? :
0 0 $fmt =~ /43|44|45|46/ ? :
406 0 17 unless $stuff
407 8 9 if ($stuff =~ m[/.*?[?&;!](?:v|video_id)=([^&#?=/;]+)]) { }
4 5 elsif ($stuff =~ m[/(?:e|v|embed)/([^&#?=/;]+)]) { }
1 4 elsif ($stuff =~ m[#p/(?:u|search)/\d+/([^&?/]+)]) { }
1 3 elsif ($stuff =~ m[youtu.be/([^&#?=/;]+)]) { }
426 0 10 unless $stuff
427 4 6 if ($stuff =~ m[/.*?[?&;!]list=([^&#?=/;]+)]) { }
3 3 elsif ($stuff =~ /^\s*([FP]L[\w\-]+)\s*$/) { }
438 0 4 unless $stuff
439 3 1 if ($stuff =~ m[/user/([^&#?=/;]+)])
453 0 0 unless $nextUrl
454 0 0 if $args and $args->{'limit'} and $fetchCnt >= $args->{'limit'}
465 0 0 unless $nextUrl
466 0 0 if $args and $args->{'limit'} and $fetchCnt >= $args->{'limit'}
477 0 0 if $self->{'verbose'}
481 0 0 unless $res->is_success
487 0 0 if $self->{'verbose'}
499 0 0 if ($_ =~ /window\["ytInitialData"\]/)
505 0 0 unless $line
537 0 0 unless $ref->{'contents'} and $ref->{'contents'}{'twoColumnBrowseResultsRenderer'} and $ref->{'contents'}{'twoColumnBrowseResultsRenderer'}{'tabs'} and ref $ref->{'contents'}{'twoColumnBrowseResultsRenderer'}{'tabs'} eq 'ARRAY' and $ref->{'contents'}{'twoColumnBrowseResultsRenderer'}{'tabs'}[0] and $ref->{'contents'}{'twoColumnBrowseResultsRenderer'}{'tabs'}[0]{'tabRenderer'} and $ref->{'contents'}{'twoColumnBrowseResultsRenderer'}{'tabs'}[0]{'tabRenderer'}{'content'} and $ref->{'contents'}{'twoColumnBrowseResultsRenderer'}{'tabs'}[0]{'tabRenderer'}{'content'}{'sectionListRenderer'} and $ref->{'contents'}{'twoColumnBrowseResultsRenderer'}{'tabs'}[0]{'tabRenderer'}{'content'}{'sectionListRenderer'}{'contents'} and ref $ref->{'contents'}{'twoColumnBrowseResultsRenderer'}{'tabs'}[0]{'tabRenderer'}{'content'}{'sectionListRenderer'}{'contents'} eq 'ARRAY' and $ref->{'contents'}{'twoColumnBrowseResultsRenderer'}{'tabs'}[0]{'tabRenderer'}{'content'}{'sectionListRenderer'}{'contents'}[0] and $ref->{'contents'}{'twoColumnBrowseResultsRenderer'}{'tabs'}[0]{'tabRenderer'}{'content'}{'sectionListRenderer'}{'contents'}[0]{'itemSectionRenderer'} and $ref->{'contents'}{'twoColumnBrowseResultsRenderer'}{'tabs'}[0]{'tabRenderer'}{'content'}{'sectionListRenderer'}{'contents'}[0]{'itemSectionRenderer'}{'contents'} and ref $ref->{'contents'}{'twoColumnBrowseResultsRenderer'}{'tabs'}[0]{'tabRenderer'}{'content'}{'sectionListRenderer'}{'contents'}[0]{'itemSectionRenderer'}{'contents'} eq 'ARRAY' and $ref->{'contents'}{'twoColumnBrowseResultsRenderer'}{'tabs'}[0]{'tabRenderer'}{'content'}{'sectionListRenderer'}{'contents'}[0]{'itemSectionRenderer'}{'contents'}[0] and $ref->{'contents'}{'twoColumnBrowseResultsRenderer'}{'tabs'}[0]{'tabRenderer'}{'content'}{'sectionListRenderer'}{'contents'}[0]{'itemSectionRenderer'}{'contents'}[0]{'playlistVideoListRenderer'} and $ref->{'contents'}{'twoColumnBrowseResultsRenderer'}{'tabs'}[0]{'tabRenderer'}{'content'}{'sectionListRenderer'}{'contents'}[0]{'itemSectionRenderer'}{'contents'}[0]{'playlistVideoListRenderer'}{'contents'} and ref $ref->{'contents'}{'twoColumnBrowseResultsRenderer'}{'tabs'}[0]{'tabRenderer'}{'content'}{'sectionListRenderer'}{'contents'}[0]{'itemSectionRenderer'}{'contents'}[0]{'playlistVideoListRenderer'}{'contents'} eq 'ARRAY'
550 0 0 @{$video->{'title'}{'runs'};} ? :
562 0 0 if ($self->{'verbose'})
574 0 0 if ($playlistVideoListRenderer->{'continuations'} and ref $playlistVideoListRenderer->{'continuations'} eq 'ARRAY' and $playlistVideoListRenderer->{'continuations'}[0] and $playlistVideoListRenderer->{'continuations'}[0]{'nextContinuationData'})
584 0 0 if ($self->{'verbose'})
607 0 0 if $self->{'verbose'}
615 0 0 unless $res->is_success
617 0 0 if $self->{'verbose'}
636 0 0 unless ref $ref eq 'ARRAY' and $ref->[1] and $ref->[1]{'response'} and $ref->[1]{'response'}{'continuationContents'} and $ref->[1]{'response'}{'continuationContents'}{'playlistVideoListContinuation'} and $ref->[1]{'response'}{'continuationContents'}{'playlistVideoListContinuation'}{'contents'} and ref $ref->[1]{'response'}{'continuationContents'}{'playlistVideoListContinuation'}{'contents'} eq 'ARRAY'
648 0 0 @{$video->{'title'}{'runs'};} ? :
660 0 0 if ($self->{'verbose'})
672 0 0 if ($playlistVideoListContinuation->{'continuations'} and ref $playlistVideoListContinuation->{'continuations'} eq 'ARRAY' and $playlistVideoListContinuation->{'continuations'}[0] and $playlistVideoListContinuation->{'continuations'}[0]{'nextContinuationData'})
681 0 0 if ($self->{'verbose'})