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'})

By default feincms_oembed uses the Embedly Oembed Provider. This provider requires an API key even for the free plan. settings.EMBEDLY_KEY must therefore be set. The free plan is good for 5000 URLs per month.

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.5.1.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

feincms_oembed-1.5.1-py2.py3-none-any.whl (15.1 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

  • Download URL: feincms-oembed-1.5.1.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.6.9

File hashes

Hashes for feincms-oembed-1.5.1.tar.gz
Algorithm Hash digest
SHA256 1523b43d7b71e64e29759c0ca85abf6de007a6d1f55ab0e747c8399063fb25f7
MD5 0d8924ac80709c1b67f8668afd245f9c
BLAKE2b-256 5c04309022b5f898ee8da73b7ade49dcd44e6e6abfb63c04cfe9df3eee43c5b0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: feincms_oembed-1.5.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 15.1 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.6.9

File hashes

Hashes for feincms_oembed-1.5.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 8e363511b7d20082821aff7660a9c5b7112ba2c90015bcb467756a428d4dfb02
MD5 257b897b1ecd0f4029ae85e4c93b4fc0
BLAKE2b-256 3331f15f9632f072c806dff8a6782852cc4c1f1c5d5f69f40084cac08757bce7

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