Skip to content

adjunct.oembed

An oEmbed client library.

As a general rule, you'll only ever need the adjunct.oembed.fetch function.

fetch(url, max_width=None, max_height=None)

Fetch the oEmbed document for a resource at url from the provider.

Parameters:

Name Type Description Default
url str

URL of oEmbed document

required
max_width int | None

desired maximum width of the thumbnail, if any

None
max_height int | None

desired maximum height of the thumbnail, if any

None

Returns:

Type Description
dict[str, str | int] | None

An oEmbed document as a dictionary; None if the document could not be fetched or the content type of the response was not valid for an oEmbed document.

get_oembed(links, max_width=None, max_height=None)

Given a URL, fetch its associated oEmbed information.

Parameters:

Name Type Description Default
links Collection[dict[str, str]]

a collection of link tags represented as attribute dictionaries

required
max_width int | None

desired maximum width of the thumbnail, if any

None
max_height int | None

desired maximum height of the thumbnail, if any

None

Returns:

Type Description
dict[str, str | int] | None

An oEmbed document as a dictionary; None if the document could not be fetched or the content type of the response was not valid for an oEmbed document.