diff --git a/Build.PL b/Build.PL index 390f036..0c8db3a 100755 --- a/Build.PL +++ b/Build.PL @@ -41,6 +41,7 @@ my $builder = Module::Build->new( 'HTTP::Request' => 0, 'JSON' => 0, 'Encode' => 0, + 'Memoize' => 0, 'MIME::Base64' => 0, 'List::Util' => 0, 'LWP::UserAgent' => 0, diff --git a/META.json b/META.json index 2e1fc14..74032e9 100644 --- a/META.json +++ b/META.json @@ -44,6 +44,7 @@ "LWP::UserAgent" : "0", "List::Util" : "0", "MIME::Base64" : "0", + "Memoize" : "0", "Term::ANSIColor" : "0", "Term::ReadLine" : "0", "Text::ParseWords" : "0", diff --git a/META.yml b/META.yml index b9a3d98..0e1f601 100644 --- a/META.yml +++ b/META.yml @@ -69,6 +69,7 @@ requires: LWP::UserAgent: '0' List::Util: '0' MIME::Base64: '0' + Memoize: '0' Term::ANSIColor: '0' Term::ReadLine: '0' Text::ParseWords: '0' diff --git a/Makefile.PL b/Makefile.PL index bd6cee2..cd78dec 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -18,6 +18,7 @@ WriteMakefile 'LWP::UserAgent' => 0, 'List::Util' => 0, 'MIME::Base64' => 0, + 'Memoize' => 0, 'Term::ANSIColor' => 0, 'Term::ReadLine' => 0, 'Test::More' => 0, diff --git a/bin/straw-viewer b/bin/straw-viewer index ddaa540..8dce1ca 100755 --- a/bin/straw-viewer +++ b/bin/straw-viewer @@ -3565,11 +3565,10 @@ sub print_video_info { $rep = 0 if $rep < 0; - print "\n$hr\n", q{ } x $rep => (_bold_color("=>> $title <<=") . "\n\n"), - map(sprintf(q{-> } . "%-*s: %s\n", $opt{_colors} ? 18 : 10, _bold_color($_->[0]), $_->[1]), - grep { - defined($_->[1]) and $_->[1] !~ /^(0|unknown)\z/i - } ( + print("\n$hr\n", q{ } x $rep => (_bold_color("=>> $title <<=") . "\n\n"), + ( + map { sprintf(q{-> } . "%-*s: %s\n", $opt{_colors} ? 18 : 10, _bold_color($_->[0]), $_->[1]) } + grep { defined($_->[1]) and $_->[1] !~ /^(0|unknown)\z/i } ( ['Channel' => $yv_utils->get_channel_title($video)], ['ChannelID' => $yv_utils->get_channel_id($video)], ['VideoID' => $yv_utils->get_video_id($video)], @@ -3580,8 +3579,9 @@ sub print_video_info { ['Dislikes' => $yv_utils->set_thousands($yv_utils->get_dislikes($video))], ['Views' => $yv_utils->set_thousands($yv_utils->get_views($video))], ['Published' => $yv_utils->get_publication_date($video)], - )), - "$hr\n"; + ) + ), + "$hr\n"); return 1; } diff --git a/lib/WWW/StrawViewer.pm b/lib/WWW/StrawViewer.pm index ee53c7a..6cfe4db 100644 --- a/lib/WWW/StrawViewer.pm +++ b/lib/WWW/StrawViewer.pm @@ -4,6 +4,12 @@ use utf8; use 5.016; use warnings; +use Memoize; + +memoize('_get_video_info'); +memoize('_extract_from_ytdl'); +memoize('_extract_from_invidious'); + use parent qw( WWW::StrawViewer::Search WWW::StrawViewer::Videos @@ -686,7 +692,8 @@ sub _extract_from_invidious { if (@instances) { require List::Util; @instances = List::Util::shuffle(map { $_->[0] } @instances); - #push @instances, 'invidious.13ad.de'; + push @instances, 'invidious.snopyta.org'; + push @instances, 'invidious.13ad.de'; } else { @instances = qw( diff --git a/lib/WWW/StrawViewer/Videos.pm b/lib/WWW/StrawViewer/Videos.pm index bd75306..e44c5aa 100644 --- a/lib/WWW/StrawViewer/Videos.pm +++ b/lib/WWW/StrawViewer/Videos.pm @@ -225,6 +225,7 @@ sub video_details { } @{$video->{thumbnail}{thumbnails}} ], + liveNow => $video->{isLiveContent}, description => $video->{shortDescription}, lengthSeconds => $video->{lengthSeconds},