(unfurl url
&
{:keys [follow-redirects timeout-ms user-agent max-content-length
proxy-host proxy-port]
:or {follow-redirects true
timeout-ms 1000
user-agent "unfurl"
max-content-length 16384
proxy-host nil
proxy-port nil}})
Unfurls the given url, throwing an exception if the url is invalid, returning nil if the given url is nil or not supported, or a map containing some or all of the following keys (none of which are mandatory):
{ :url - The url of the resource, according to the server :title - The title of the given url :description - The description of the given url :preview-url - The url of a preview image for the given url }
Options are provided as key/value pairs, with any/all of the following keys:
{ :follow-redirects (default: true) - whether to follow 30x redirects :timeout-ms (default: 1000) - timeout in ms (used for both the socket and connect timeouts) :user-agent (default: "unfurl") - user agent string to send in the HTTP request :max-content-length (default: 16384) - maximum length (in bytes) of content to retrieve (using HTTP range requests) :proxy-host (default: nil) - HTTP proxy hostname :proxy-port (default: nil) - HTTP proxy port }
Thrown exceptions will usually be an ExceptionInfo with the ex-data containing:
{ :request - the details of the HTTP request that was attempted :response - the details of the HTTP response that was received (comes directly from clj-http) }
Unfurls the given url, throwing an exception if the url is invalid, returning nil if the given url is nil or not supported, or a map containing some or all of the following keys (none of which are mandatory): { :url - The url of the resource, according to the server :title - The title of the given url :description - The description of the given url :preview-url - The url of a preview image for the given url } Options are provided as key/value pairs, with any/all of the following keys: { :follow-redirects (default: true) - whether to follow 30x redirects :timeout-ms (default: 1000) - timeout in ms (used for both the socket and connect timeouts) :user-agent (default: "unfurl") - user agent string to send in the HTTP request :max-content-length (default: 16384) - maximum length (in bytes) of content to retrieve (using HTTP range requests) :proxy-host (default: nil) - HTTP proxy hostname :proxy-port (default: nil) - HTTP proxy port } Thrown exceptions will usually be an ExceptionInfo with the ex-data containing: { :request - the details of the HTTP request that was attempted :response - the details of the HTTP response that was received (comes directly from clj-http) }
Unfurls the given url, returning a core.async channel in which a result will be made available. If the request is successful, the result will be a map containing some or all of the following keys (none of which are mandatory):
{ :url - The url of the resource, according to the server :title - The title of the given url :description - The description of the given url :preview-url - The url of a preview image for the given url }
Options are provided as key/value pairs, with any/all of the following keys:
{ :follow-redirects (default: true) - whether to follow 30x redirects :timeout-ms (default: 1000) - timeout in ms (used for both the socket and connect timeouts) :user-agent (default: "unfurl") - user agent string to send in the HTTP request :max-content-length (default: 16384) - maximum length (in bytes) of content to retrieve (using HTTP range requests) * NOT WORKING * :proxy-host (default: nil) - HTTP proxy hostname :proxy-port (default: nil) - HTTP proxy port }
If the request is not successful, the result will be nil if the resource is not HTML, or a map containing the following keys:
{ :status - the HTTP status of the response - usually 0 :success - if the request was successfull - always false :body - the body of the response - usually empty :headers - the headers of the response - usually empty :trace-redirects - the redirects made by the request - unreliable :error-code - the code of the error - usually :http-error :error-text - the error message - usually [0] }
Error messages are unfortunately not very informative at the moment. Make sure that the URL is valid, that it provides unfurling metadata, that its content type header is set to HTML, and that its CORS header is set to '*'.
Unfurls the given url, returning a core.async channel in which a result will be made available. If the request is successful, the result will be a map containing some or all of the following keys (none of which are mandatory): { :url - The url of the resource, according to the server :title - The title of the given url :description - The description of the given url :preview-url - The url of a preview image for the given url } Options are provided as key/value pairs, with any/all of the following keys: { :follow-redirects (default: true) - whether to follow 30x redirects :timeout-ms (default: 1000) - timeout in ms (used for both the socket and connect timeouts) :user-agent (default: "unfurl") - user agent string to send in the HTTP request :max-content-length (default: 16384) - maximum length (in bytes) of content to retrieve (using HTTP range requests) * NOT WORKING * :proxy-host (default: nil) - HTTP proxy hostname :proxy-port (default: nil) - HTTP proxy port } If the request is not successful, the result will be nil if the resource is not HTML, or a map containing the following keys: { :status - the HTTP status of the response - usually 0 :success - if the request was successfull - always false :body - the body of the response - usually empty :headers - the headers of the response - usually empty :trace-redirects - the redirects made by the request - unreliable :error-code - the code of the error - usually :http-error :error-text - the error message - usually [0] } Error messages are unfortunately not very informative at the moment. Make sure that the URL is valid, that it provides unfurling metadata, that its content type header is set to HTML, and that its CORS header is set to '*'.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close