Skip to main content

Module preview

Module preview 

Source
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Β§

CachedPreview πŸ”’
Oembed πŸ”’
The oEmbed fields a preview can carry.
UrlPreviewData

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 type into 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 want more bytes, growing geometrically but never past limit.
spider_body πŸ”’
Read a page body up to limit, reporting whether the cap cut it short.
video_type πŸ”’
Translate an oEmbed video document into the type a preview can carry.

Type AliasesΒ§

MediaType πŸ”’
A media type as declared by a page, inline for every common spelling.