diff options
author | trizen <trizen@protonmail.com> | 2020-09-06 11:18:24 +0300 |
---|---|---|
committer | Jesús <heckyel@hyperbola.info> | 2020-09-14 10:54:53 -0500 |
commit | a2ce13749b09345ee6e18c8f09ff2242f0fa9078 (patch) | |
tree | 81c2c0723bf106ab850f0e35949f1cc890f8b4f0 | |
parent | 185bc58f0d53dcf16255d5c206758c1aedf623ba (diff) | |
download | fair-viewer-a2ce13749b09345ee6e18c8f09ff2242f0fa9078.tar.lz fair-viewer-a2ce13749b09345ee6e18c8f09ff2242f0fa9078.tar.xz fair-viewer-a2ce13749b09345ee6e18c8f09ff2242f0fa9078.zip |
Documented `--api=auto`.
Signed-off-by: Jesús <heckyel@hyperbola.info>
-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; |