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 /lib/WWW/FairViewer.pm | |
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 'lib/WWW/FairViewer.pm')
-rw-r--r-- | lib/WWW/FairViewer.pm | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/WWW/FairViewer.pm b/lib/WWW/FairViewer.pm index 11a8bba..a82c8ae 100644 --- a/lib/WWW/FairViewer.pm +++ b/lib/WWW/FairViewer.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::FairViewer::Search WWW::FairViewer::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( |