Skip to main content

Generate embeddable HTML or JavaScript code for a online content from its URL in single step

Project description

|License|

embedX
======

Generate embeddable HTML or JavaScript code for a online content from
its URL in a single step.

The content can be: \* Yotube video \* Twitter status \* Vimeo video \*
etc.

Embeddable code-generation be simple like this:

::

>>> from embed_x import OnlineContent
>>> oc = OnlineContent('http://www.youtube.com/embed/_lOT2p_FCvA')
>>> oc.get_embed_code()
"<div class='embedx-yt'><iframe src='http://www.youtube.com/embed/_lOT2p_FCvA' 'frameborder='0' allowfullscreen></iframe></div>"

Currently, supports
~~~~~~~~~~~~~~~~~~~

- Youtube video
- Vimeo video
- Twitter : single status
-

Examples of URLs
~~~~~~~~~~~~~~~~

Valid
^^^^^

- http://youtu.be/\_lOT2p\_FCvA
- www.youtube.com/watch?v=\_lOT2p\_FCvA&feature=feedu
- http://www.youtube.com/embed/\_lOT2p\_FCvA
- http://www.youtube.com/v/\_lOT2p\_FCvA?version=3&amp;hl=en\_US
- https://www.youtube.com/watch?v=rTHlyTphWP0&index=6&list=PLjeDyYvG6-40qawYNR4juzvSOg-ezZ2a6
- youtube.com/watch?v=\_lOT2p\_FCvA
- https://vimeo.com/groups/animation/videos/150618894/
- https://vimeo.com/150519302
- https://twitter.com/codinghorror/status/686254714938200064
-

Invalid:
^^^^^^^^

- youtu.be/watch?v=\_lOT2p\_FCvA [ because Youtube don’t give any url
like this ]
- https://twitter.com/gvanrossum/with\_replies
-

Install
-------

from PyPI
~~~~~~~~~

::

pip install embedX

Directly from source
~~~~~~~~~~~~~~~~~~~~

::

pip install git+https://github.com/kmonsoor/embedX.git

Usage
-----

::

>>> from online_video import OnlineVideo
>>> oc = OnlineVideo('http://www.youtube.com/embed/_lOT2p_FCvA')
>>> oc.get_video_id()
'_lOT2p_FCvA'

>>> oc.get_embed_code()

"<div class='embed-container'><iframe src='http://www.youtube.com/embed/_lOT2p_FCvA' 'frameborder='0'allowfullscreen></iframe></div>"

>>> oc = OnlineVideo('https://vimeo.com/groups/animation/videos/150618894/')
>>> oc.get_embed_code()
"<div class='embed-container'> <iframe src='http://player.vimeo.com/video/150618894' frameborder='0' webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></div>"

To-do
-----

- Create test
- Provision Travis-CI for automatic building & testing
- add more content sites
- Github gists
- Facebook status
- Facebook notes
- Scribd docs
- Imgur images

Contributors
------------

- Seed idea : `A StackOverflow answer`_ by `Mikhail Kashkin`_
- Author : `Khaled Monsoor`_
-

Please try to contribute by submitting more content-sites with their
different link formats and embed-codes. You can submit pull-requests or
by creating issue.

.. _A StackOverflow answer: http://stackoverflow.com/a/7936523
.. _Mikhail Kashkin: http://stackoverflow.com/users/85739/mikhail-kashkin
.. _Khaled Monsoor: http://github.com/kmonsoor

.. |License| image:: https://img.shields.io/badge/license-MIT-blue.svg
:target: http://kmonsoor.mit-license.org/

Project details


Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
embedX-0.0.3-py2.py3-none-any.whl (2.2 kB) Copy SHA256 hash SHA256 Wheel py2.py3 Jan 12, 2016
embedX-0.0.3.tar.gz (2.7 kB) Copy SHA256 hash SHA256 Source None Jan 12, 2016

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page