The oembeditem plugin¶
The oembeditem plugin allows inserting an embedded online content in the page, such as a YouTube video, SlideShare presentation, Twitter status, Flickr photo, etc..
The presentation is rendered with the embed code:
By default, the following services are supported:
- Flickr (both videos and images)
- GitHub Gists
- Speaker Desk
- Twitter (status messages)
- YouTube (public videos and playlists)
Install the dependencies via pip:
pip install django-fluent-contents[oembeditem]
This installs the micawber package.
Add the following settings to
INSTALLED_APPS += ( 'fluent_contents.plugins.oembeditem', )
The following settings are available:
FLUENT_OEMBED_SOURCE = 'basic' # "list", "basic" or "embedly" FLUENT_OEMBED_EXTRA_PROVIDERS = ( (r'http://\S+.wordpress\.com/\S*', 'http://public-api.wordpress.com/oembed/?for=my-domain-name'), (r'http://\S+.wp\.me/\S*', 'http://public-api.wordpress.com/oembed/?for=my-domain-name'), ) MICAWBER_EMBEDLY_KEY = '' FLUENT_OEMBED_PROVIDER_LIST = ( (r'https?://(www\.)?youtube\.com/watch\S*', 'http://www.youtube.com/oembed'), (r'http://youtu\.be/\S*', 'http://www.youtube.com/oembed'), (r'http://blip\.tv/\S*', 'http://blip.tv/oembed/'), (r'https?://(www\.)?vimeo\.com/\S*', 'http://vimeo.com/api/oembed.json'), # ... )
The source to use for the OEmbed provider list. This can be one the following values:
- basic Use the list of well-known providers in the micawber package.
- noembed Use the embed service from noembed
- embedly Use the embed service from embed.ly
- list Use the provides defined in
The embed.ly service contains many providers, including sites which do not have an OEmbed implementation themselves. The service does cost money, and requires an API key. For a list of providers supported by embed.ly see http://embed.ly/providers
The basic setting is the default, and contains well known services that provide an OEmbed endpoint.
The OEmbed providers in this setting will be added to the existing set that
Each item is a tuple with the regular expression and endpoint URL.
A fixed hard-coded list of providers.
Specify this setting to override the complete set of default OEmbed providers.
To add additional providers to any existing source, use
Each item is a tuple with two fields:
- The regular expression to match the URL.
- The OEmbed provider endpoint.
Note that the regular expressions never test for
.* but use
so micawber can also detect the URL within a larger fragment.
Note that an OEmbed element is fetched from another server, which specifies how the embed code looks like.
Hence, only known online services are whitelisted via the
This reduces the risks for Cross-site scripting (XSS) attacks.
Hence, the OEmbed discovery protocol is not supported either.