diff options
author | trizen <trizen@protonmail.com> | 2020-07-11 00:30:37 +0300 |
---|---|---|
committer | Jesús <heckyel@hyperbola.info> | 2020-07-27 21:21:25 -0500 |
commit | ddc0b8872b38b739f2dd0b55bf280ca182df03c5 (patch) | |
tree | 8b49129efbedc89377e0aaa764f210923580d2b0 | |
parent | 18e5d6c30dc9080fc3ef69157ac6f9f8991bdf54 (diff) | |
download | fair-viewer-ddc0b8872b38b739f2dd0b55bf280ca182df03c5.tar.lz fair-viewer-ddc0b8872b38b739f2dd0b55bf280ca182df03c5.tar.xz fair-viewer-ddc0b8872b38b739f2dd0b55bf280ca182df03c5.zip |
Minor code simplification.
Signed-off-by: Jesús <heckyel@hyperbola.info>
-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; |