Friday, February 14, 2014

PyEmbed, a content embedding library for Python

By Vasudev Ram

Saw PyEmbed today via the Python Weekly email newsletter. PyEmbed is a Python library for embedding content in a web page. Given a URL of some content, it fetches the embed code for it, which you can then embed in an HTML page.

PyEmbed looks good on an initial try. I thought for a while about what video to test PyEmebed with, and finally settled on a YouTube video of the Indian film actress Rekha, in a famous dance scene in the film Umrao Jaan, which won her a National Film Award for Best Actress.

For all my readers who don't know Hindi (the movie is in Hindi), there are English subtitles at the bottom of the video.

PyEmbed is quite simple to use for basic usage, though it does have some advanced features.

Here is a simple Python program using PyEmbed to fetch the embed code for the Rekha dance video from the film Umrao Jaan described above:
from pyembed.core import PyEmbed
html = PyEmbed().embed('')
print html

I ran it with:


And then pasted the resulting HTML below to embed the video:

Rekha dancing in the movie Umrao Jaan

- Vasudev Ram - Dancing Bison Enterprises

Read other Python posts on my blog.

Contact Page

No comments: