diff options
-rw-r--r-- | README.md | 14 | ||||
-rwxr-xr-x | bin/fair-viewer | 3 | ||||
-rw-r--r-- | lib/WWW/FairViewer.pm | 3 |
3 files changed, 14 insertions, 6 deletions
@@ -98,16 +98,22 @@ To package this application, run the following commands: ### INVIDIOUS INSTANCES -Sometimes, the default instance, [invidious.snopyta.org](https://invidious.snopyta.org/), may fail to work properly. When this happens, we can change the API host to some other instance of invidious, such as [invidious.fdn.fr](https://invidious.fdn.fr/). +Sometimes, the default instance, [invidious.snopyta.org](https://invidious.snopyta.org/), may fail to work properly. When this happens, we can change the API host to some other instance of invidious, such as [invidious.13ad.de](https://invidious.13ad.de/). ```console - fair-viewer --api=invidious.fdn.fr + fair-viewer --api=invidious.13ad.de ``` -This can be changed permanently, by setting in the configuration file: +To make the change permanent, set in the configuration file: ```perl - api_host => "invidious.fdn.fr", + api_host => "invidious.13ad.de", +``` + +Alternatively, by setting `api_host` to `"auto"`, fair-viewer will automatically pick a random invidious instance: + +```console + api_host => "auto", ``` The available instances are listed at: https://instances.invidio.us/ diff --git a/bin/fair-viewer b/bin/fair-viewer index 4fce8e3..6907290 100755 --- a/bin/fair-viewer +++ b/bin/fair-viewer @@ -791,7 +791,8 @@ usage: $execname [options] ([url] | [keywords]) --use-colors! : enable or disable the ANSI colors for text * Other - --api-host=s : set an API host from https://instances.invidio.us/ + --api=s : set an API host from https://instances.invidio.us/ + --api=auto : use a random instance of invidious --proxy=s : set HTTP(S)/SOCKS proxy: 'proto://domain.tld:port/' If authentication required, use 'proto://user:pass\@domain.tld:port/' diff --git a/lib/WWW/FairViewer.pm b/lib/WWW/FairViewer.pm index 2f7314a..59307d5 100644 --- a/lib/WWW/FairViewer.pm +++ b/lib/WWW/FairViewer.pm @@ -495,6 +495,7 @@ sub _append_url_args { sub get_invidious_instances { my ($self) = @_; + require File::Spec; my $instances_file = File::Spec->catfile($self->get_config_dir, 'instances.json'); # Get the "instances.json" file when the local copy is too old or non-existent @@ -508,7 +509,7 @@ sub get_invidious_instances { $resp->is_success() or return; - my $json = $resp->decoded_content() // return; + my $json = $resp->decoded_content() || return; open(my $fh, '>', $instances_file) or return; print $fh $json; close $fh; |