diff options
-rw-r--r-- | lib/WWW/FairViewer/Itags.pm | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/lib/WWW/FairViewer/Itags.pm b/lib/WWW/FairViewer/Itags.pm index 15ef710..52ad82b 100644 --- a/lib/WWW/FairViewer/Itags.pm +++ b/lib/WWW/FairViewer/Itags.pm @@ -172,6 +172,8 @@ sub _find_streaming_url { foreach my $itag (@{$args{itags}->{$resolution}}) { + next if not exists $stream->{$itag->{value}}; + if ($itag->{hfr}) { $args{hfr} || next; # skip high frame rate (HFR) videos } @@ -179,8 +181,6 @@ sub _find_streaming_url { if ($itag->{dash}) { $args{dash} || next; - next if not exists $stream->{$itag->{value}}; - my $video_info = $stream->{$itag->{value}}; my $audio_info = $self->_find_streaming_url(%args, resolution => 'audio', dash => 0); @@ -192,23 +192,20 @@ sub _find_streaming_url { next; } - if (exists $stream->{$itag->{value}}) { - - if ($resolution eq 'audio' and not $args{dash_mp4_audio}) { - if ($itag->{format} eq 'mp4') { - next; # skip mp4 audio URLs - } + if ($resolution eq 'audio' and not $args{dash_mp4_audio}) { + if ($itag->{format} eq 'mp4') { + next; # skip mp4 audio URLs } + } - my $entry = $stream->{$itag->{value}}; - - # Ignore segmented DASH URLs (they load pretty slow in mpv) - if (not $args{dash_segmented}) { - next if ($entry->{url} =~ m{^https://manifest\.googlevideo\.com/api/manifest/dash/}); - } + my $entry = $stream->{$itag->{value}}; - return $entry; + # Ignore segmented DASH URLs (they load pretty slow in mpv) + if (not $args{dash_segmented}) { + next if ($entry->{url} =~ m{^https://manifest\.googlevideo\.com/api/manifest/dash/}); } + + return $entry; } return; |