From f141f51a9613c9d74680b1c9eb923ca7f20f901b Mon Sep 17 00:00:00 2001 From: trizen Date: Wed, 4 Nov 2020 14:25:02 +0200 Subject: - Stricter selection of a random invidious instance (with api_host => "auto"). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ensure that a randomly selected invidious actually works, by making a search request with keyword "test". Additionally, in the selection of instances, only include instances with "weeklyRatio = success" and "dailyRatios[0] = "success" (in addition to "statusClass = sucess"). Signed-off-by: Jesús --- lib/WWW/FairViewer/Utils.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/WWW/FairViewer') diff --git a/lib/WWW/FairViewer/Utils.pm b/lib/WWW/FairViewer/Utils.pm index ccb5800..0144aec 100644 --- a/lib/WWW/FairViewer/Utils.pm +++ b/lib/WWW/FairViewer/Utils.pm @@ -223,6 +223,8 @@ Returns true if a given result has entries. sub has_entries { my ($self, $result) = @_; + $result // return 0; + if (ref($result->{results}) eq 'HASH') { foreach my $type (qw(comments videos playlists)) { @@ -247,7 +249,6 @@ sub has_entries { } return 1; # maybe? - #ref($result) eq 'HASH' and ($result->{results}{pageInfo}{totalResults} > 0); } =head2 normalize_video_title($title, $fat32safe) -- cgit v1.2.3