diff --git a/bin/gtk-straw-viewer b/bin/gtk-straw-viewer index db3012f..59cf0f3 100755 --- a/bin/gtk-straw-viewer +++ b/bin/gtk-straw-viewer @@ -204,7 +204,7 @@ my %CONFIG = ( comments_order => 'top', # valid values: time, relevance # API - api_host => "https://invidio.us", + api_host => "https://invidious.snopyta.org", # URI options thumbnail_type => 'medium', diff --git a/bin/straw-viewer b/bin/straw-viewer index baa104d..13a8385 100755 --- a/bin/straw-viewer +++ b/bin/straw-viewer @@ -210,7 +210,7 @@ my %CONFIG = ( cache_dir => undef, # API - api_host => "https://invidio.us", + api_host => "https://invidious.snopyta.org", # Others autoplay_mode => 0, diff --git a/lib/WWW/StrawViewer.pm b/lib/WWW/StrawViewer.pm index 7ee808d..5c34342 100644 --- a/lib/WWW/StrawViewer.pm +++ b/lib/WWW/StrawViewer.pm @@ -497,6 +497,10 @@ sub get_api_url { my $host = $self->get_api_host; + # Remove whitespace (if any) + $host =~ s/^\s+//; + $host =~ s/\s+\z//; + $host =~ s{/+\z}{}; # remove trailing '/' if ($host =~ m{^[-\w]+(?>\.[-\w]+)+\z}) { # no protocol specified @@ -504,9 +508,11 @@ sub get_api_url { } # After October 1st, the invidio.us API will no longer work. - # Starting with September 30th, use "invidious.snopyta.org" instead. - if (time > 1601424000 and $host =~ m{^https://(?:www\.)?invidio\.us\b}) { + # Use "invidious.snopyta.org" instead. + if ($host =~ m{^https://(?:www\.)?invidio\.us\b}) { $host = "https://invidious.snopyta.org"; + ##print STDERR ":: Changing the API host to $host\n"; + $self->set_api_host($host); } join('', $host, $self->get_api_path);