diff options
author | trizen <trizen@protonmail.com> | 2020-09-15 22:31:01 +0300 |
---|---|---|
committer | Jesús <heckyel@hyperbola.info> | 2020-09-28 21:44:05 -0500 |
commit | 1f3b2b85a1ea6a1b523469bf4cb0a8089ab4f84d (patch) | |
tree | df354eb5915803c9bc1487613518c2404bf96b98 /bin/fair-viewer | |
parent | 192dd6d100f070a95be6868aa7ab7c3992859c1a (diff) | |
download | fair-viewer-1f3b2b85a1ea6a1b523469bf4cb0a8089ab4f84d.tar.lz fair-viewer-1f3b2b85a1ea6a1b523469bf4cb0a8089ab4f84d.tar.xz fair-viewer-1f3b2b85a1ea6a1b523469bf4cb0a8089ab4f84d.zip |
- Added instance-caching for `_get_video_info()`, `_extract_from_ytdl()` and `_extract_from_invidious()`.
Too many requests to `_get_video_info()` and/or `hypervideo` may lead to a "429 - Too Many Requests" issue.
Caching these functions may help to prevent this a little bit.
Also playing the same video twice, the second time it will load much faster, since `_get_video_info()` is cached.
Signed-off-by: Jesús <heckyel@hyperbola.info>
Diffstat (limited to 'bin/fair-viewer')
-rwxr-xr-x | bin/fair-viewer | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/bin/fair-viewer b/bin/fair-viewer index 0414696..ab84393 100755 --- a/bin/fair-viewer +++ b/bin/fair-viewer @@ -3568,11 +3568,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)], @@ -3583,8 +3582,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; } |