Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
- Changed the default API host to invidious.snopyta.org. (closes #24)
Browse files Browse the repository at this point in the history
The instance `invidio.us` seems to be down at the moment.

Also of interest: #23
  • Loading branch information
trizen committed Aug 8, 2020
1 parent 3faaf55 commit 4807a31
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion bin/gtk-straw-viewer
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion bin/straw-viewer
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
10 changes: 8 additions & 2 deletions lib/WWW/StrawViewer.pm
Original file line number Diff line number Diff line change
Expand Up @@ -497,16 +497,22 @@ 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
$host = 'https://' . $host; # default to HTTPS
}

# 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);
Expand Down

0 comments on commit 4807a31

Please sign in to comment.