aboutsummaryrefslogtreecommitdiffstats
path: root/lib/WWW/FairViewer/Utils.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/WWW/FairViewer/Utils.pm')
-rw-r--r--lib/WWW/FairViewer/Utils.pm14
1 files changed, 11 insertions, 3 deletions
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 {