aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortrizen <trizen@protonmail.com>2020-08-08 11:03:37 +0300
committerJesús <heckyel@hyperbola.info>2020-08-14 14:43:44 -0500
commitbf596c266d09ee08ff725edf8d75da5425d6748c (patch)
tree300426cb702f48087764122b66c9e790117127f0
parent187d7126312f810f4f84f3652cdbb49c0057b37b (diff)
downloadfair-viewer-bf596c266d09ee08ff725edf8d75da5425d6748c.tar.lz
fair-viewer-bf596c266d09ee08ff725edf8d75da5425d6748c.tar.xz
fair-viewer-bf596c266d09ee08ff725edf8d75da5425d6748c.zip
Try to be more helpful when the API instance fails.
Instead of dying with "Not an ARRAY reference", it now prints a message saying how to change the API host. Signed-off-by: Jesús <heckyel@hyperbola.info>
-rwxr-xr-xbin/fair-viewer9
1 files changed, 8 insertions, 1 deletions
diff --git a/bin/fair-viewer b/bin/fair-viewer
index 40689e5..7c9478c 100755
--- a/bin/fair-viewer
+++ b/bin/fair-viewer
@@ -3591,12 +3591,19 @@ sub print_videos {
}
my $url = $results->{url};
- my $videos = $results->{results} // [];
+ my $videos = $results->{results} // [];
if (ref($videos) eq 'HASH' and exists $videos->{videos}) {
$videos = $videos->{videos};
}
+ if (ref($videos) ne 'ARRAY') {
+ say "\n:: Probably ", $yv_obj->get_api_host, " is down. Try:";
+ say "\n\t$0 --api=yewtu.be\n";
+ say "See also: https://libregit.org/heckyel/fair-viewer#invidious-instances";
+ return;
+ }
+
#my $videos = $info->{items} // [];
#~ foreach my $entry (@$videos) {