aboutsummaryrefslogtreecommitdiffstats
path: root/lib/WWW/FairViewer.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/WWW/FairViewer.pm')
-rw-r--r--lib/WWW/FairViewer.pm11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/WWW/FairViewer.pm b/lib/WWW/FairViewer.pm
index 977e8af..abe25cd 100644
--- a/lib/WWW/FairViewer.pm
+++ b/lib/WWW/FairViewer.pm
@@ -84,6 +84,10 @@ my %valid_options = (
cache_dir => {valid => qr/^./, default => q{.}},
cookie_file => {valid => qr/^./, default => undef},
+ # Support for hypervideo
+ ytdl => {valid => [1, 0], default => 1},
+ ytdl_cmd => {valid => qr/\w/, default => "hypervideo"},
+
# Booleans
env_proxy => {valid => [1, 0], default => 1},
escape_utf8 => {valid => [1, 0], default => 0},
@@ -743,7 +747,8 @@ sub _extract_from_invidious {
}
sub _ytdl_is_available {
- (state $x = system('hypervideo', '--version')) == 0;
+ my ($self) = @_;
+ ($self->proxy_stdout($self->get_ytdl_cmd(), '--version') // '') =~ /\d/;
}
sub _extract_from_ytdl {
@@ -751,7 +756,7 @@ sub _extract_from_ytdl {
$self->_ytdl_is_available() || return;
- my @ytdl_cmd = ('hypervideo', '--all-formats', '--dump-single-json');
+ my @ytdl_cmd = ($self->get_ytdl_cmd(), '--all-formats', '--dump-single-json');
my $cookie_file = $self->get_cookie_file;
@@ -787,7 +792,7 @@ sub _fallback_extract_urls {
my @formats;
# Use hypervideo
- if ($self->_ytdl_is_available) {
+ if ($self->get_ytdl and $self->_ytdl_is_available) {
if ($self->get_debug) {
say STDERR ":: Using hypervideo to extract the streaming URLs...";