View Source z_url_metadata (zotonic_stdlib v1.23.1)
Discover metadata about an url. First follows any redirects and URL shorteners, then fetches the data at the final URL to inspect all metadata tags, content headers and first part of the HTML. The returned opaque metadata can be questioned with properties. The Slackbot user-agent is used for fetching URLs so that the URL shorteners return a location header and other sites are coerced to give correct metadata. Only the first MB of data is fetched, this prevents fetching large objects.
Summary
Types
-type property() :: mime | mime_options | site_name | content_length | url | canonical_url | short_url | final_url | headers | title | h1 | summary | tags | filename | mtitle | description | keywords | author | charset | language | image | image_nav | thumbnail | icon | icon_nav | icon_shortcut | icon_touch | binary().
Functions
Fetch metadata information for the URL
-spec fetch(binary() | string(), z_url_fetch:options()) -> {ok, metadata()} | {error, term()}.
-spec p(Property, Metadata) -> Value when Property :: property() | [property()], Metadata :: metadata(), Value :: binary() | [binary()] | Headers | undefined, Headers :: [{binary(), binary()}].
Fetch properties of the fetched metadata