aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/fair-viewer34
-rwxr-xr-xbin/gtk-fair-viewer22
2 files changed, 49 insertions, 7 deletions
diff --git a/bin/fair-viewer b/bin/fair-viewer
index ff70dea..d0fcf8f 100755
--- a/bin/fair-viewer
+++ b/bin/fair-viewer
@@ -16,7 +16,7 @@
#-------------------------------------------------------
# fair-viewer
# Fork: 14 February 2020
-# Edit: 09 September 2020
+# Edit: 05 October 2020
# https://framagit.org/heckyel/fair-viewer
#-------------------------------------------------------
@@ -252,6 +252,10 @@ my %CONFIG = (
convert_cmd => 'ffmpeg -i *IN* *OUT*',
convert_to => undef,
+ # hypervideo support
+ ytdl => 1,
+ ytdl_cmd => undef, # auto-defined
+
custom_layout => undef, # auto-defined
custom_layout_format => [{width => 3, align => "right", color => "bold", text => "*NO*.",},
{width => "55%", align => "left", color => "bold blue", text => "*TITLE*",},
@@ -463,6 +467,21 @@ sub load_config {
}
}
+ # Locate hypervideo
+ if (not defined($CONFIG{ytdl_cmd})) {
+
+ my $ytdl_path = which_command('hypervideo');
+
+ if (defined($ytdl_path)) {
+ $CONFIG{ytdl_cmd} = $ytdl_path;
+ }
+ else {
+ $CONFIG{ytdl_cmd} = 'hypervideo';
+ }
+
+ $update_config = 1;
+ }
+
# Download with wget if it is installed
if (not defined $CONFIG{download_with_wget}) {
@@ -602,6 +621,8 @@ if ($opt{history}) {
my $yv_obj = WWW::FairViewer->new(
escape_utf8 => 1,
config_dir => $config_dir,
+ ytdl => $opt{ytdl},
+ ytdl_cmd => $opt{ytdl_cmd},
cache_dir => $opt{cache_dir},
env_proxy => $opt{env_proxy},
cookie_file => $opt{cookie_file},
@@ -803,7 +824,9 @@ usage: $execname [options] ([url] | [keywords])
--dash! : include or exclude the DASH itags
--dash-mp4a! : include or exclude the itags for MP4 audio streams
--dash-segmented! : include or exclude segmented DASH streams
-
+ --ytdl! : use hypervideo for videos with encrypted signatures
+ `--no-ytdl` will use invidious instances
+ --ytdl-cmd=s : hypervideo command (default: hypervideo)
Help options:
-T --tricks : show more 'hidden' features of $execname
@@ -1088,7 +1111,7 @@ sub apply_configuration {
channelId region debug hl
http_proxy page comments_order
subscriptions_order user_agent
- cookie_file timeout
+ cookie_file timeout ytdl ytdl_cmd
)
) {
@@ -1596,6 +1619,9 @@ sub parse_arguments {
'pos|position=i' => \$opt{position},
'ps|playlist-save=s' => \$opt{playlist_save},
+ 'ytdl!' => \$opt{ytdl},
+ 'ytdl-cmd=s' => \$opt{ytdl_cmd},
+
'quiet|q!' => \$opt{quiet},
'really-quiet!' => \$opt{really_quiet},
'video-info!' => \$opt{show_video_info},
@@ -3361,7 +3387,7 @@ sub get_player_command {
);
if ($streaming->{streaming}{url} =~ m{^https://www\.youtube\.com/watch\?v=}) {
- $cmd =~ s{ --no-ytdl\b}{ }g;
+ $cmd =~ s{\s*--no-ytdl\b}{ }g;
}
$has_video ? $cmd : join(' ', $cmd, quotemeta($streaming->{streaming}{url}));
diff --git a/bin/gtk-fair-viewer b/bin/gtk-fair-viewer
index 593e929..18c52db 100755
--- a/bin/gtk-fair-viewer
+++ b/bin/gtk-fair-viewer
@@ -16,7 +16,7 @@
#-------------------------------------------------------
# GTK Fair Viewer
# Fork: 14 February 2020
-# Edit: 09 September 2020
+# Edit: 05 October 2020
# https://framagit.org/heckyel/fair-viewer
#-------------------------------------------------------
@@ -226,6 +226,10 @@ my %CONFIG = (
fullscreen => 0,
audio_only => 0,
+ # hypervideo support
+ ytdl => 1,
+ ytdl_cmd => undef, # auto-detect
+
tooltips => 1,
tooltip_max_len => 512, # max length of description in tooltips
@@ -737,6 +741,16 @@ foreach my $path ($CONFIG{cache_dir}) {
}
}
+# Locate hypervideo
+if (not defined $CONFIG{ytdl_cmd}) {
+ if (defined(my $path = which_command('hypervideo'))) {
+ $CONFIG{ytdl_cmd} = $path;
+ }
+ else {
+ $CONFIG{ytdl_cmd} = 'hypervideo';
+ }
+}
+
# Locate video player
if (not $CONFIG{video_player_selected}) {
@@ -805,6 +819,8 @@ $CONFIG{fair_viewer} //= which_command('fair-viewer') // 'fair-viewer';
my $yv_obj = WWW::FairViewer->new(
escape_utf8 => 1,
config_dir => $config_dir,
+ ytdl => $CONFIG{ytdl},
+ ytdl_cmd => $CONFIG{ytdl_cmd},
hl => $CONFIG{hl},
env_proxy => $CONFIG{env_proxy},
cache_dir => $CONFIG{cache_dir},
@@ -864,7 +880,7 @@ sub apply_configuration {
videoLicense
region videoCategoryId
debug http_proxy user_agent
- timeout cookie_file
+ timeout cookie_file ytdl ytdl_cmd
)
) {
@@ -3073,7 +3089,7 @@ sub get_player_command {
);
if ($streaming->{streaming}{url} =~ m{^https://www\.youtube\.com/watch\?v=}) {
- $cmd =~ s{ --no-ytdl\b}{ }g;
+ $cmd =~ s{\s*--no-ytdl\b}{ }g;
}
$has_video ? $cmd : join(' ', $cmd, quotemeta($streaming->{streaming}{url}));