aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Phillips <david@sighup.nz>2018-06-19 00:12:14 +1200
committerDavid Phillips <david@sighup.nz>2018-06-19 00:19:48 +1200
commit53718f690df53285362145ee474f40a2f5cc63e7 (patch)
tree6d7154c079777c3b7b710e0223e1be9e25172af1
parentb1f4150fc408b00e20117be28ff111a3d3c27fa8 (diff)
downloadidalius-53718f690df53285362145ee474f40a2f5cc63e7.tar.xz
URL_Title: Allow SVG titling
-rw-r--r--Plugin/URL_Title.pm8
1 files changed, 5 insertions, 3 deletions
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;
}