From ad3d9dec0bbbac9fe6b4e7894272de341041b44c Mon Sep 17 00:00:00 2001 From: trizen Date: Sun, 2 Aug 2020 14:21:12 +0300 Subject: In description, handle decoding of `youtu.be` links and other internal URLs. 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 | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib/WWW/FairViewer/Utils.pm') diff --git a/lib/WWW/FairViewer/Utils.pm b/lib/WWW/FairViewer/Utils.pm index 5521a2e..9f4afbc 100644 --- a/lib/WWW/FairViewer/Utils.pm +++ b/lib/WWW/FairViewer/Utils.pm @@ -486,6 +486,16 @@ sub get_description { "$url/$params"; }segi; + # Decode internal youtu.be links + $desc =~ s{(https://youtu\.be)/.*?}{ + my $url = $2; + my $params = URI::Escape::uri_unescape($1); + "$url/$params"; + }segi; + + # Decode other internal links + $desc =~ s{.*?}{https://youtube.com/$1}sgi; + $desc =~ s{
}{\n}gi; $desc =~ s{.*?}{$1}sgi; $desc =~ s/<.*?>//gs; -- cgit v1.2.3