diff options
author | Jesús <heckyel@hyperbola.info> | 2020-11-09 15:55:55 -0500 |
---|---|---|
committer | Jesús <heckyel@hyperbola.info> | 2020-11-09 15:55:55 -0500 |
commit | ad60d6661706d750c45fba098813aa9f02307d55 (patch) | |
tree | 2555ac310b301b77083629041a1441347e4d05aa /bin | |
parent | e320434680fe8e72327b1d4d6f05b3a3e2723149 (diff) | |
download | fair-viewer-ad60d6661706d750c45fba098813aa9f02307d55.tar.lz fair-viewer-ad60d6661706d750c45fba098813aa9f02307d55.tar.xz fair-viewer-ad60d6661706d750c45fba098813aa9f02307d55.zip |
update from upstream
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/fair-viewer | 34 | ||||
-rwxr-xr-x | bin/gtk-fair-viewer | 22 |
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})); |