diff options
author | trizen <trizen@protonmail.com> | 2020-06-05 23:19:15 +0300 |
---|---|---|
committer | Jesús <heckyel@hyperbola.info> | 2020-06-06 22:05:56 -0500 |
commit | 751dd4e0d6ac3fe6a45c51e742a2b73ba69a4eed (patch) | |
tree | 128fba638ce4d849437b139d651c63500a852a6f /bin | |
parent | 4621e4af0b93c5654e022158122f4fb64cf12799 (diff) | |
download | fair-viewer-751dd4e0d6ac3fe6a45c51e742a2b73ba69a4eed.tar.lz fair-viewer-751dd4e0d6ac3fe6a45c51e742a2b73ba69a4eed.tar.xz fair-viewer-751dd4e0d6ac3fe6a45c51e742a2b73ba69a4eed.zip |
- Added a fallback method for extracting video information. - Decode internal YouTube URLs in description. - Various fixes and improvements.
Signed-off-by: Jesús <heckyel@hyperbola.info>
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/fair-viewer | 26 | ||||
-rwxr-xr-x | bin/gtk-fair-viewer | 9 |
2 files changed, 19 insertions, 16 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); diff --git a/bin/gtk-fair-viewer b/bin/gtk-fair-viewer index e8ea8c4..e68a8c4 100755 --- a/bin/gtk-fair-viewer +++ b/bin/gtk-fair-viewer @@ -16,7 +16,7 @@ #------------------------------------------------------- # GTK Fair Viewer # Fork: 14 February 2020 -# Edit: 14 February 2020 +# Edit: 05 June 2020 # https://framagit.org/heckyel/fair-viewer #------------------------------------------------------- @@ -2226,11 +2226,8 @@ sub check_keywords { if ($key =~ /$get_video_id_re/o) { my $info = $yv_obj->video_details($+{video_id}); - - if ($yv_utils->has_entries($info)) { - if (not play_video($info->{results})) { - return; - } + if (ref($info) eq 'HASH' and keys %$info) { + play_video($info) || return; } else { return; |