unfurl.api
unfurl
(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
, defaulttrue
): Whether to follow 30x redirects.:timeout-ms
(long
, default1000
) 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
, default16384
) 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 metadataunfurl
uses).:proxy-host
(String
, defaultnil
) HTTP proxy hostname.:proxy-port
(long
, defaultnil
) HTTP proxy port.:http-headers
(a map withString
keys andString
values, defaultnil
) A map of any other HTTP request headers you might wantunfurl
to include in the requests it makes.
Throws on I/O errors, usually an ExceptionInfo with the ex-data
containing:
:request
(a map withString
keys andString
values) Contains the details of the HTTP request that was attempted.:response
(a map withString
keys andString
values) Contains the details of the HTTP response that was received (directly fromclj-http
).