python oembed消费者库与生产者的自动发现
pyembed的Python项目详细描述
pyembed
oembed 具有 制片人。
pyembed允许您轻松地将内容从 各种制作人(包括flickr、twitter和youtube。 与许多oEmbed使用者不同,您不需要配置每个生产者 您要使用的-pyembed自动发现配置。
您只需要提供url,pyembed将生成 HTML,准备好包含在页面中:
>>> from pyembed.core import PyEmbed >>> html = PyEmbed().embed('http://www.youtube.com/watch?v=9bZkp7q19f0') <iframe width="480" height="270" src="http://www.youtube.com/embed/9bZkp7q19f0?feature=oembed" frameborder="0" allowfullscreen></iframe>
有一些插件可以将内容嵌入到 标记中 重新构造文本 文档,并使用 jinja2自定义嵌入 以及 胡子模板。有关详细信息,请参见pyembed网站。
兼容性
PyEmbed已经用Python2.7和3.3进行了测试。
安装
pyembed可以使用pip安装:
pip install pyembed
许可证
PyEmbed是根据麻省理工学院的许可证发行的。
Copyright (c) 2013 Matt Thomson Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.