diff options
Diffstat (limited to 'bin/fair-viewer')
-rwxr-xr-x | bin/fair-viewer | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/bin/fair-viewer b/bin/fair-viewer index 7f3377c..d50164f 100755 --- a/bin/fair-viewer +++ b/bin/fair-viewer @@ -16,7 +16,7 @@ #------------------------------------------------------- # fair-viewer # Fork: 14 February 2020 -# Edit: 14 February 2020 +# Edit: 05 June 2020 # https://framagit.org/heckyel/fair-viewer #------------------------------------------------------- @@ -2078,15 +2078,21 @@ sub rate_videos { sub get_and_play_video_ids { (my @ids = grep { get_valid_video_id($_) } @_) || return; - my $info = $yv_obj->video_details(join(',', @ids)); - if ($yv_utils->has_entries($info)) { - if (not play_videos([$info->{results}])) { - return; + foreach my $id (@ids) { + my $info = $yv_obj->video_details($id); + + if (ref($info) eq 'HASH' and keys %$info) { + ## OK } - } - else { - warn_cant_do('get info for', @ids); + else { + $info->{title} = "unknwon"; + $info->{lengthSeconds} = 0; + $info->{videoId} = $id; + warn_cant_do('get info for', $id); + } + + play_videos([$info]) || return; } return 1; @@ -2107,9 +2113,9 @@ sub get_and_print_video_info { my $videoID = get_valid_video_id($id) // next; my $info = $yv_obj->video_details($videoID); - if ($yv_utils->has_entries($info)) { + if (ref($info) eq 'HASH' and keys %$info) { local $opt{show_video_info} = 1; - print_video_info($info->{results}); + print_video_info($info); } else { warn_cant_do('get info for', $videoID); |