Skip to main content

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:

  1. Add 'feincms_oembed' to INSTALLED_APPS.

  2. 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/:

  1. type of the embedded object (e.g. ‘video’) + .html

  2. type of the content type (e.g. ‘transparent’) + .html

  3. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

feincms-oembed-1.3.2.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

feincms_oembed-1.3.2-py2.py3-none-any.whl (15.9 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file feincms-oembed-1.3.2.tar.gz.

File metadata

File hashes

Hashes for feincms-oembed-1.3.2.tar.gz
Algorithm Hash digest
SHA256 b4b9b68e3fa39aa9ef1824d18b66e9af85c3975f19c06e668b0cefb022c4c3ae
MD5 a54dfe25edbef53ad5b9d79d90326545
BLAKE2b-256 0042561df264a8b3761c1d01b189df2bf8c5e0eeddd26ecd0573663e5e8df8c9

See more details on using hashes here.

File details

Details for the file feincms_oembed-1.3.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for feincms_oembed-1.3.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 7ee8dca6f7cc40a1e31b8128cb35aaa4e0ad2c6f4c9e2b9a0e776f8764ce9291
MD5 6aee08e1a6d1b01861eb96ca50605364
BLAKE2b-256 9744afc1de1a41ead4e9aee4b696254f13d6a8320d8986ffcd679395cb099771

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page