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.

Source Distribution

embedX-0.0.3.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

embedX-0.0.3-py2.py3-none-any.whl (2.2 kB view details)

Uploaded Python 2Python 3

File details

Details for the file embedX-0.0.3.tar.gz.

File metadata

  • Download URL: embedX-0.0.3.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for embedX-0.0.3.tar.gz
Algorithm Hash digest
SHA256 f14818bf43f71990e1d21a97107d55ab4d747216e04893ee1aa9ab46602182a0
MD5 bf7288ffec57a3285c28ec9914ceb1c7
BLAKE2b-256 986b3d78275adb1939b47a43f5c4ac4d02c22a998ae1ed4326f2f395cd46331a

See more details on using hashes here.

File details

Details for the file embedX-0.0.3-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for embedX-0.0.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 565d479c599a4a9edfa1473cc36444df4fd47bda31318bee64c561010858cd42
MD5 2864ebe4d1219ede6d1548aad75e4a26
BLAKE2b-256 95aa2a32998b07599e2b75fb67bf27370716ae54c2cd78a99015c2a5e35592ec

See more details on using hashes here.

Supported by

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