OEmbed anything.
Project description
feincms-oembed converts standard URLs from more than 200 content providers into embedded videos, images and rich article previews by letting Embedly or another OEmbed provider to the hard work.
It’s stunningly simple to use:
Add 'feincms_oembed' to INSTALLED_APPS.
Create the content type:
from feincms.module.page.models import Page from feincms_oembed.contents import OembedContent TYPE_CHOICES = [ ('default', _('Default presentation'), { 'maxwidth': 500, 'maxheight': 300, 'wmode': 'opaque'}), ('transparent', _('Transparent'), { 'maxwidth': 500, 'maxheight': 300, 'wmode': 'transparent'}), ] Page.create_content_type(OembedContent, TYPE_CHOICES=TYPE_CHOICES)
You can also specify additional parameters which are sent to the OEmbed provider too:
Page.create_content_type(OembedContent, TYPE_CHOICES=TYPE_CHOICES, PARAMS={'wmode': 'opaque', 'key': settings.EMBEDLY_KEY})
If you want to customize the Embedly request or use another OEmbed provider, set settings.OEMBED_PROVIDER to a function receiving the URL and a dict with additional arguments and returning a suitable URL which returns OEmbed JSON on access. OEMBED_PROVIDER must either be a dotted python path or a callable:
from feincms_oembed.providers import embedly_oembed_provider def my_provider(url, kwargs): kwargs['wmode'] = 'opaque' return embedly_oembed_provider(url, kwargs) OEMBED_PROVIDER = 'path.to.module.my_provider' # OEMBED_PROVIDER = my_provider # The function can be used too, not only # the dotted python path.
The content is looking for templates in the following order in the folder content/external/:
type of the embedded object (e.g. ‘video’) + .html
type of the content type (e.g. ‘transparent’) + .html
default.html
If you don’t want any surprises with blocked access to Embedly it is suggested that you register for a free API key.
Using the FeedContent
If you want to use the FeedContent, make sure you have feedparser in your Python path.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file feincms-oembed-1.3.3.tar.gz
.
File metadata
- Download URL: feincms-oembed-1.3.3.tar.gz
- Upload date:
- Size: 9.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 83d17b2179da805242c21a0aff32a30c2312d34404b4ba939b681d9352ebd7aa |
|
MD5 | 2acb4467d8b875eca3c335ec34eac34e |
|
BLAKE2b-256 | f2f639de7ca0f6de8ae4b9abe7bfee2ee8b8d57a378f1ec00357b0a4972a76ed |
File details
Details for the file feincms_oembed-1.3.3-py2.py3-none-any.whl
.
File metadata
- Download URL: feincms_oembed-1.3.3-py2.py3-none-any.whl
- Upload date:
- Size: 16.0 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | afbb220c3d8e8580ea69cffc2ec2173c9514a99d6b87fcd41055e2886686c6bf |
|
MD5 | 02cc3489e9a4061f813fbef3614cd1ab |
|
BLAKE2b-256 | 4095f0d78f6099e0bc214518b37e83c0b7bff261ad9f7b43cbde9e614436c70a |