From 53718f690df53285362145ee474f40a2f5cc63e7 Mon Sep 17 00:00:00 2001 From: David Phillips Date: Tue, 19 Jun 2018 00:12:14 +1200 Subject: URL_Title: Allow SVG titling --- Plugin/URL_Title.pm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'Plugin') diff --git a/Plugin/URL_Title.pm b/Plugin/URL_Title.pm index 3297bed..6d46e43 100644 --- a/Plugin/URL_Title.pm +++ b/Plugin/URL_Title.pm @@ -41,7 +41,9 @@ sub message } return unless $url; - my $http = HTTP::Tiny->new((default_headers => {'Range' => "bytes=0-65536", 'Accept' => 'text/html'}, timeout => 3)); + # FIXME add more XML-based formats that we can theoretically extract titles from + # FIXME factor out accepted formats and response match into accepted formats array + my $http = HTTP::Tiny->new((default_headers => {'Range' => "bytes=0-65536", 'Accept' => 'text/html, image/svg+xml'}, timeout => 3)); my $response = $http->get($url); @@ -50,8 +52,8 @@ sub message return; } - if (!($response->{headers}->{"content-type"} =~ m,text/html ?,)) { - $logger->("Not html, giving up now"); + if (!($response->{headers}->{"content-type"} =~ m,(text/html|image/svg\+xml),)) { + $logger->("I don't think I can parse titles from $response->{headers}->{'content-type'} - stopping here"); return; } -- cgit v1.1