Expand description
URL Previews
This functionality is gated by βurl_previewβ, but not at the unit level for historical and simplicity reasons. Instead the feature gates the inclusion of dependencies and nulls out results through the existing interface when not featured.
StructsΒ§
- Cached
Preview π - Oembed π
- The oEmbed fields a preview can carry.
- UrlPreview
Data
EnumsΒ§
- Agent π
- Which configured agent a preview request speaks as.
ConstantsΒ§
- OEMBED_
MAX_ πSIZE - An oEmbed document runs to a few hundred bytes; the cap bounds only a hostile origin.
- YOUTUBE_
CONSENT_ πCOOKIE - Consent state that suppresses the interstitial Google serves in place of the page in some regions.
- YOUTUBE_
HOSTS π - Hosts whose pages carry their
<head>metadata only for an allowlisted crawler, and which answer oEmbed for any agent. - YOUTUBE_
OEMBED π - Endpoint answering oEmbed for every host in
YOUTUBE_HOSTS, including the short and subdomain forms.
FunctionsΒ§
- checked_
media_ πsize - Parse a direct-file previewβs advertised size, refusing one over the cap so we never register an mxc the relay is guaranteed to reject at fetch time.
- declares_
media_ πtype - Whether an OpenGraph media objectβs declared type belongs to
class. - is_
youtube π - oembed_
endpoint π - The oEmbed endpoint answering for
url, when its origin has one. - og_type π
- Translate an oEmbed
typeinto the OpenGraph vocabulary the preview response is defined in. - require_
media_ πtype - Verify a possibly-refetched preview response still carries the content type class the page response was dispatched on, so a media-client refetch that substitutes a different type is not mis-registered.
- reserve_
capped π - Reserve
wantmore bytes, growing geometrically but never pastlimit. - spider_
body π - Read a page body up to
limit, reporting whether the cap cut it short. - video_
type π - Translate an oEmbed
videodocument into the type a preview can carry.
Type AliasesΒ§
- Media
Type π - A media type as declared by a page, inline for every common spelling.