{ "info": { "author": "Christian Scholz, COM.lounge GmbH", "author_email": "mrtopf@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Internet :: WWW/HTTP", "Topic :: Software Development :: Libraries", "Topic :: Text Processing :: Filters", "Topic :: Text Processing :: Markup :: HTML" ], "description": "=========\nembeddify\n=========\n\nTurns links into embed codes. Useful for any system accepting user inputs which wants to make\nit easier for the user to add rich content and safer for the platform at the same time by\nnot allowing any direct iframe tags.\n\nUsage\n=====\n\n\nHere is a quick example::\n\n >>> from embeddify import Embedder\n >>> embedder = Embedder()\n >>> embedder(\"https://www.youtube.com/watch?v=2wii8hfNkzE\")\n \n\nThis works right now for\n\n* youtube.com (plugin name: ``youtube``)\n* vimeo.com (plugin name: ``vimeo``)\n* flickr.com (plugin name: ``flickr``)\n* slideshare.net (plugin name: ``slideshare``)\n* facebook.com videos (plugin name: ``facebookvideos``)\n\nThe raw OEmbed data can be accessed via the ``data`` attribute of the result if the result is an ``OEmbedMarkup`` instance::\n\n >>> result = embedder(\"https://www.youtube.com/watch?v=2wii8hfNkzE\")\n >>> isinstance(result, embedder.OEmbedMarkup)\n True\n >>> result.data['thumbnail_url']\n https://i.ytimg.com/vi/2wii8hfNkzE/hqdefault.jpg\n\nIf a link can not be converted then the link will be returned.\n\n\nConfiguration\n=============\n\nYou can configure the embedding tool by giving it a width and height to be used. This is given as maximum width/height to the\noEmbed endpoints of the services and thus the resulting object might be smaller.\n\nYou can configure this for all embed plugins generically like this::\n \n embedder = Embedder(width=100, height=100)\n\nYou can also configure it on a per plugin basis using the plugin name mentioned above like this::\n \n plugin_config = {\n 'youtube': {'width' : 200},\n 'slideshare': {'width' : 500},\n }\n embedder = Embedder(plugin_config = plugin_config)\n\nThe plugin specific configuration overwrites the generic configuration.\n\nYou can also pass in arguments on a call by call basis like this::\n\n embedder = Embedder()\n embedder(\"https://www.youtube.com/watch?v=2wii8hfNkzE\", width=200)\n\nAutoplay\n--------\n\nSome providers support autoplay. You can use it with the autoplay setting::\n\n embedder = Embedder(autoplay=True)\n\nNormally YouTube wouldn't support this setting, but the YouTube plugin handles\nit by rewriting the returned HTML code. This may break if YouTube ever changes\nthe HTML code.\n\nAdditional parameters\n---------------------\n\nSome OEmbed providers allow additional parameters. For example Vimeo allows\nautoplay::\n\n >>> embedder('https://player.vimeo.com/video/6791752', params=dict(autoplay=True))\n \n\n\nChoosing which plugins to use\n-----------------------------\n\nIf you don't want all the plugins to be active you can choose which ones you want to use by providing a list\nof plugins to use like this::\n \n import embeddify\n plugins = [embeddify.YouTube(), embeddify.Vimeo()] # only video\n embedder = Embedder(plugins = plugins)\n \n\nCreating your own plugins\n=========================\n\nIn order to extend the functionality with additional services you can create your own plugins. Depending on\nthe service and whether it provides an `oEmbed endpoint `_ or not you can one of two base classes, \n``Plugin`` or ``OEmbedPlugin``.\n\nUsing an oEmbed endpoint\n------------------------\n\nIn order to write a plugin for an oEmbed enabled service you need to know it's endpoint. For instance the YouTube implementation\nsimply looks like this::\n\n\n from embeddify import OEmbedPlugin\n\n class YouTube(OEmbedPlugin):\n \"\"\"converts youtube links into embeds\n \"\"\"\n\n api_url = \"http://www.youtube.com/oembed\"\n\n def test(self, parts):\n \"\"\"test if the plugin is able to convert that link\"\"\"\n return \"youtube.com\" in parts.netloc\n\n\nSo you simply need to put in the URL of the endpoint and a ``test()`` method. This gets the result of the\n``urlparse.urlparse()`` call as input and usually simply checks the ``netloc`` attribute for the right domain.\nIf it returns ``False`` the next plugin will be tried, if it returns ``True`` the endpoint will be called and\nin case that call was successful, the embed code will be returned. Otherwise again the next plugin will be tried.\n\nUsing a plain plugin\n--------------------\n\nIf there is no oEmbed endpoint available or you want to create a plugin without an external call, you can derive from the\n``Plugin`` class like so::\n\n from embeddify import Plugin\n\n class ExamplePlugin(Plugin):\n \n default = {\n 'width' : 200,\n 'height' : 300,\n }\n \n def __call__(self, parts, config = {}):\n if \"example.org\" in parts.netloc:\n return \"\"\"\"\"\" %config['width']\n return None\n\nAgain you get the results of ``urlparse.urlparse()`` passed into the plugin as well as a ``config`` dictionary. You then\nhave to test whether your plugin knows about this service and if you do, just return a string with the embed code.\nIf your plugin is not responsible or something else went wrong, simply return ``None``. Then the next plugin will be tried.\n\nIn order to accept configuration, simply create a ``default`` dictionary in the class. This will be copied to your config\nand updated with plugin specific configuration and call by call configuration and then passed in as ``config`` parameter.\nSo you shouldn't have to do any modifications on it, just make sure you provide some default value.\n\n\nLicense\n=======\n\nThis package is released under the BSD license.\n\n\nAuthor\n======\n\nembeddify is written by Christian 'mrtopf' Scholz, COM.lounge GmbH. \n\n\nContributors\n============\n\nFlorian Schulze (fschulze)\n\n\nSource Code\n===========\n\nThe source code can be found on `github `_.\n\n\n\nChangelog\n=========\n\n0.3.1 (2017-08-28)\n------------------\n\n- Fix for unicode in markup for Python 2.7 [fschulze]\n\n\n0.3.0 (2017-07-31)\n------------------\n\n- Support autoplay setting and add a workaround in the YouTube plugin [fschulze]\n\n- Allow sending of additional parameters via ``params`` keyword [fschulze]\n\n- Don't let calling Embedder with keywords overwrite the plugin\n configuration [fschulze]\n\n- The dictionary with raw OEmbed data can by accessed via the ``data``\n attribute of the result if it comes from an OEmbed plugin [fschulze]\n\n- Python 3.x compatibility [fschulze]\n\n\n0.2.0 (2016-11-21)\n------------------\n\n- support youtu.be links [fschulze]\n\n- support facebook.com videos [fschulze]\n\n- use https endpoints for all services [fschulze]\n\n- changed flickr oembed to return a linked image instead of just an image. [mrtopf]\n \n- added class `flickr-embed-img` to flickr image for better styling [mrtopf]\n \n- split ``__call__()`` on plugins into two methods, ``do_request()`` for\n performing the actual request and ``__call__()`` will do the actual\n processing [mrtopf]\n\n\n0.1.1 (2016-10-27)\n------------------\n\n- fix tests and packaging\n\n\n0.1.0.2 (2014-03-30)\n--------------------\n\n- fixed tests\n\n\n0.1.0.1 (2013-06-20)\n--------------------\n\n- initial release\n\n\n\n\n\n\n\n\n\n\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/mrtopf/embeddify", "keywords": "oembed embed html youtube vimeo slideshare flickr", "license": "BSD", "maintainer": "", "maintainer_email": "", "name": "embeddify", "package_url": "https://pypi.org/project/embeddify/", "platform": "", "project_url": "https://pypi.org/project/embeddify/", "project_urls": { "Homepage": "https://github.com/mrtopf/embeddify" }, "release_url": "https://pypi.org/project/embeddify/0.3.1/", "requires_dist": null, "requires_python": "", "summary": "converts URLs to embed codes", "version": "0.3.1" }, "last_serial": 3128749, "releases": { "0.1.0.1": [ { "comment_text": "", "digests": { "md5": "d3ab22e63896d839abcccd109ed78c65", "sha256": "98a56af44df7cd7acaf3b1be9d5c84288027fa6fdb67a82db24942c070e9cfd6" }, "downloads": -1, "filename": "embeddify-0.1.0.1.tar.gz", "has_sig": false, "md5_digest": "d3ab22e63896d839abcccd109ed78c65", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4999, "upload_time": "2013-06-20T11:03:48", "url": "https://files.pythonhosted.org/packages/1c/d2/b938884613c1365b453ecde53ce5d640203e74a1691ce96f72b2cb9b3f46/embeddify-0.1.0.1.tar.gz" } ], "0.1.0.2": [ { "comment_text": "", "digests": { "md5": "713ac3eceeddc03530e8988bd5d4180a", "sha256": "faa34041908b3d56b9fe24595219bdf399e0acbbeca6e0a2783ae1d5316930a5" }, "downloads": -1, "filename": "embeddify-0.1.0.2.tar.gz", "has_sig": false, "md5_digest": "713ac3eceeddc03530e8988bd5d4180a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4655, "upload_time": "2014-03-30T13:29:58", "url": "https://files.pythonhosted.org/packages/f5/74/d0fb9fd2c4c84ebb73ebc144a2693baf2d578431b99798c8afa842b14451/embeddify-0.1.0.2.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "8879e81fc3137c1c32995c44abdf7ab2", "sha256": "6ac727abc856ca0295a46d592bc0b2ef5f7fb113fdf9498bcf0a613801756c54" }, "downloads": -1, "filename": "embeddify-0.1.1.tar.gz", "has_sig": false, "md5_digest": "8879e81fc3137c1c32995c44abdf7ab2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5835, "upload_time": "2016-10-27T10:30:49", "url": "https://files.pythonhosted.org/packages/6a/de/c9650cfab32faef6f8f6d5050228b17547bc0cd461f48660c841ce413cd5/embeddify-0.1.1.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "b3793be18b22a631942a13721d8c1f6a", "sha256": "41dced7d973629f22d1dbff71916cae0f18813d3e7c288a03e283dca086d7db9" }, "downloads": -1, "filename": "embeddify-0.2.0.tar.gz", "has_sig": false, "md5_digest": "b3793be18b22a631942a13721d8c1f6a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6837, "upload_time": "2016-11-21T11:43:26", "url": "https://files.pythonhosted.org/packages/3f/c4/b75a48e9d8e72882597230f711ff97e3fde8985739084a8dd07abe237bb4/embeddify-0.2.0.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "554375fa6f11be6d314ecb3c4a4a670e", "sha256": "b5cee5788ec619364d88417a13e67b82ed2c760cbad0c3508a5ff578c2cd6ed2" }, "downloads": -1, "filename": "embeddify-0.3.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "554375fa6f11be6d314ecb3c4a4a670e", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 10718, "upload_time": "2017-07-31T14:44:25", "url": "https://files.pythonhosted.org/packages/60/ef/9d7b9b09e04e730b75efdb0988c9a24f765ee16e167d39e69130ce6f4ae3/embeddify-0.3.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ef7b0575927a096f9297b40d794c00cd", "sha256": "0d53f0c020ff5ae4bfdab6ac96af20bfd750b3f90a31d129e877ccce02ce4c55" }, "downloads": -1, "filename": "embeddify-0.3.0.tar.gz", "has_sig": false, "md5_digest": "ef7b0575927a096f9297b40d794c00cd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8337, "upload_time": "2017-07-31T14:44:25", "url": "https://files.pythonhosted.org/packages/b2/e3/c39d1632dff1014291ed52db5d37d9760bfc6a1669d4dce442267ff43c45/embeddify-0.3.0.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "f4e638b36efcf059582b525834bbd49b", "sha256": "fecdbe77bc052300390821c5441c8187ead7f11ad1558d15cad295c292867bd7" }, "downloads": -1, "filename": "embeddify-0.3.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "f4e638b36efcf059582b525834bbd49b", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 10817, "upload_time": "2017-08-28T10:55:50", "url": "https://files.pythonhosted.org/packages/1b/34/8d851d48875b1b0cd3071ba1c222f72cd24f4f1498e9ad2b05729b1fdfa4/embeddify-0.3.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "077764e878338d314a606bcabaee4895", "sha256": "c6ddd6ffa70e8173ef6603cdade4a18f7568c787fb4a114dd20313525ea03bbe" }, "downloads": -1, "filename": "embeddify-0.3.1.zip", "has_sig": false, "md5_digest": "077764e878338d314a606bcabaee4895", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18077, "upload_time": "2017-08-28T10:55:49", "url": "https://files.pythonhosted.org/packages/9b/16/6a94ed8204eba657e944806de56cc0dd9792652a5429ec83cceccfab1d16/embeddify-0.3.1.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f4e638b36efcf059582b525834bbd49b", "sha256": "fecdbe77bc052300390821c5441c8187ead7f11ad1558d15cad295c292867bd7" }, "downloads": -1, "filename": "embeddify-0.3.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "f4e638b36efcf059582b525834bbd49b", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 10817, "upload_time": "2017-08-28T10:55:50", "url": "https://files.pythonhosted.org/packages/1b/34/8d851d48875b1b0cd3071ba1c222f72cd24f4f1498e9ad2b05729b1fdfa4/embeddify-0.3.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "077764e878338d314a606bcabaee4895", "sha256": "c6ddd6ffa70e8173ef6603cdade4a18f7568c787fb4a114dd20313525ea03bbe" }, "downloads": -1, "filename": "embeddify-0.3.1.zip", "has_sig": false, "md5_digest": "077764e878338d314a606bcabaee4895", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18077, "upload_time": "2017-08-28T10:55:49", "url": "https://files.pythonhosted.org/packages/9b/16/6a94ed8204eba657e944806de56cc0dd9792652a5429ec83cceccfab1d16/embeddify-0.3.1.zip" } ] }