(unfurl url
&
{:keys [follow-redirects timeout-ms user-agent max-content-length
proxy-host proxy-port http-headers]
:or {follow-redirects true
timeout-ms 1000
user-agent "https://github.com/pmonks/unfurl"
max-content-length 16384
proxy-host nil
proxy-port nil
http-headers nil}})
Unfurls the given url
, returning nil
if url
is nil
or not supported,
or a map containing some or all of the following keys (all of which are
optional):
:url
(String
)
The url of the resource, according to the server.:title
(String
)
The title of the given url.:description
(String
)
A brief textual description of the given url.:preview-url
(String
)
The url of a preview image for the given url.Options are:
:follow-redirects
(boolean
, default true
):
Whether to follow 30x redirects.:timeout-ms
(long
, default 1000
)
Timeout in ms (used for both the socket and connect timeouts).:user-agent
(String
, default "https://github.com/pmonks/unfurl"
)
User agent string to send in the HTTP request. This should be either a
browser identification string, an email address, or a URL, as some servers
will reject requests with User Agent values that aren't in one of these
domains.:max-content-length
(long
, default 16384
)
Maximum length (in bytes) of content to retrieve, using HTTP range requests
(the entire content does not normally need to be retrieved in order to get
the metadata unfurl
uses).:proxy-host
(String
, default nil
)
HTTP proxy hostname.:proxy-port
(long
, default nil
)
HTTP proxy port.:http-headers
(a map with String
keys and String
values, default nil
)
A map of any other HTTP request headers you might want unfurl
to include
in the requests it makes.Throws on I/O errors, usually an ExceptionInfo with the ex-data
containing:
:request
(a map with String
keys and String
values)
Contains the details of the HTTP request that was attempted.:response
(a map with String
keys and String
values)
Contains the details of the HTTP response that was received (directly from
clj-http
).Unfurls the given `url` , returning `nil` if `url` is `nil` or not supported, or a map containing some or all of the following keys (all of which are optional): * `:url` (`String`) The url of the resource, according to the server. * `:title` (`String`) The title of the given url. * `:description` (`String`) A brief textual description of the given url. * `:preview-url` (`String`) The url of a preview image for the given url. Options are: * `:follow-redirects` (`boolean`, default `true`): Whether to follow 30x redirects. * `:timeout-ms` (`long`, default `1000`) Timeout in ms (used for both the socket and connect timeouts). * `:user-agent` (`String`, default `"https://github.com/pmonks/unfurl"`) User agent string to send in the HTTP request. This should be either a browser identification string, an email address, or a URL, as some servers will reject requests with User Agent values that aren't in one of these domains. * `:max-content-length` (`long`, default `16384`) Maximum length (in bytes) of content to retrieve, using HTTP range requests (the entire content does not normally need to be retrieved in order to get the metadata `unfurl` uses). * `:proxy-host` (`String`, default `nil`) HTTP proxy hostname. * `:proxy-port` (`long`, default `nil`) HTTP proxy port. * `:http-headers` (a map with `String` keys and `String` values, default `nil`) A map of any other HTTP request headers you might want `unfurl` to include in the requests it makes. Throws on I/O errors, usually an ExceptionInfo with the `ex-data` containing: * `:request` (a map with `String` keys and `String` values) Contains the details of the HTTP request that was attempted. * `:response` (a map with `String` keys and `String` values) Contains the details of the HTTP response that was received (directly from `clj-http`).
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close