diff options
author | trizen <trizen@protonmail.com> | 2020-06-05 21:48:58 +0300 |
---|---|---|
committer | Jesús <heckyel@hyperbola.info> | 2020-06-06 21:54:19 -0500 |
commit | 4621e4af0b93c5654e022158122f4fb64cf12799 (patch) | |
tree | fe900baee52473f558fee4e05907bf0d714019bd /lib/WWW | |
parent | 754e30726f3af7d28a8b6e505fc44754f3b6f353 (diff) | |
download | fair-viewer-4621e4af0b93c5654e022158122f4fb64cf12799.tar.lz fair-viewer-4621e4af0b93c5654e022158122f4fb64cf12799.tar.xz fair-viewer-4621e4af0b93c5654e022158122f4fb64cf12799.zip |
- Filter out recommended videos from related videos.
Most often, they are not even related to the given video ID.
Signed-off-by: Jesús <heckyel@hyperbola.info>
Diffstat (limited to 'lib/WWW')
-rw-r--r-- | lib/WWW/FairViewer/Search.pm | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/WWW/FairViewer/Search.pm b/lib/WWW/FairViewer/Search.pm index 5660218..8e8162c 100644 --- a/lib/WWW/FairViewer/Search.pm +++ b/lib/WWW/FairViewer/Search.pm @@ -150,6 +150,9 @@ sub related_to_videoID { my $watch_next_response = $self->parse_json_string($info{watch_next_response}); my $related = eval { $watch_next_response->{contents}{twoColumnWatchNextResults}{secondaryResults}{secondaryResults}{results} } // return { results => []}; + #use Data::Dump qw(pp); + #pp $related; + my @results; foreach my $entry(@$related) { @@ -162,6 +165,9 @@ sub related_to_videoID { if ($info->{viewCountText}{simpleText} =~ /^([\d,]+) views/) { $viewCount = ($1 =~ tr/,//dr); } + elsif ($info->{viewCountText}{simpleText} =~ /Recommended for you/i) { + next; # filter out recommended videos from related videos + } my $lengthSeconds = 0; @@ -189,6 +195,7 @@ sub related_to_videoID { month => 2629743.83, # seconds in a month week => 604800, # seconds in a week day => 86400, # seconds in a day + hour => 3600, # seconds in a hour minute => 60, # seconds in a minute second => 1, # seconds in a second ); |