From e13d106d848b43d23b1fadd8d31df7374b1e95d3 Mon Sep 17 00:00:00 2001 From: trizen Date: Sat, 12 Sep 2020 14:02:46 +0300 Subject: gtk: fixed thumbnails for related videos. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jesús --- lib/WWW/FairViewer/Utils.pm | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'lib/WWW/FairViewer/Utils.pm') diff --git a/lib/WWW/FairViewer/Utils.pm b/lib/WWW/FairViewer/Utils.pm index f0a46a0..83c4512 100644 --- a/lib/WWW/FairViewer/Utils.pm +++ b/lib/WWW/FairViewer/Utils.pm @@ -542,12 +542,20 @@ sub get_thumbnail_url { my @thumbs = @{$info->{videoThumbnails}}; my @wanted = grep{$_->{quality} eq $type} @thumbs; + my $url; + if (@wanted) { - return $wanted[0]{url}; + $url = $wanted[0]{url}; + } + else { + warn "[!] Couldn't find thumbnail of type <<$type>>..."; + $url = $thumbs[0]{url}; } - warn "[!] Couldn't find thumbnail of type <<$type>>..."; - $thumbs[0]{url}; + # Clean URL of trackers and other junk + $url =~ s/\.(?:jpg|png|webp)\K\?.*//; + + return $url; } sub get_channel_title { -- cgit v1.2.3