View Source Unfurl.Oembed (Unfurl v0.6.2)

A module for managing oembed data

Summary

Functions

Returns a specification to start this module under a supervisor.

Looks for an oembed link in the HTML of the given url and fetches it

Returns an Oembed endpoint for the given url

Fetches oembed data for the given url if it comes from a known provider

Fetches the list of Oembed providers

Callback implementation for GenServer.init/1.

Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

detect_and_fetch(url, html, opts \\ [])

View Source

Looks for an oembed link in the HTML of the given url and fetches it

Link to this function

endpoint_from_html(html)

View Source
Link to this function

endpoint_from_url(url, params \\ %{"format" => "json"}, opts \\ [])

View Source

Returns an Oembed endpoint for the given url

Examples

iex> Oembed.endpoint_from_url "https://vimeo.com/88856141"
iex> Oembed.endpoint_from_url "https://vimeo.com/88856141", %{"format" => "xml"}
@spec fetch(String.t(), List.t()) ::
  {:ok, String.t()} | {:ok, nil} | {:error, Atom.t()}

Fetches oembed data for the given url if it comes from a known provider

Link to this function

fetch_providers(type \\ :soft)

View Source
@spec fetch_providers(Atom.t()) :: {:ok, List.t()} | {:error, Atom.t()}

Fetches the list of Oembed providers

Soft fetch will fetch cached providers. Hard fetch requests providers from oembed.com and purges the cache.

Callback implementation for GenServer.init/1.