How to install django-embed
- Download and install ActivePython
- Open Command Prompt
- Type
pypm install django-embed
Lastest release
Embed is a Django app to generate the embed code for youtube, twitter and slideshare.
Detailed documentation is in the "docs" directory.
Quick start
Add "embed" to your INSTALLED_APPS setting like this:
INSTALLED_APPS = ( ... 'embed', )
Run python manage.py syncdb to create the embed cache model.
Import Embed class.
from embed.utils import Embed
You can use it individually for each service or all of them.
youtube = Embed.get_youtube_embed(string="Check this video https://youtu.be/THgLyTucjmk")
The Embed will return a string with the link replaced with the embed code.
If you want use the twitter functionality you have to set your twitter api keys.
Embed.consumer_key = 'dummy-consumer-key' Embed.consumer_secret = 'dummy-consumer-secret' Embed.oauth_token = 'dummy-access-token' Embed.oauth_token_secret = 'dummy-access-token-secret'
You can set the parameters for the embed objects.
Embed.config['width'] = '430'
If you are using MySQL you need to encode to utf-8 the "embed_code" column of the EmbedCache table in your database.