{ "info": { "author": "Loftie Ellis", "author_email": "pyunfurl@unfurl.dev", "bugtrack_url": null, "classifiers": [ "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3" ], "description": "# PyUnfurl\n\nPyUnfurl is a Python library for embedding ('unfurling') content from other sites into your own site, similar to the way slack expands links. \nUseful for easily embedding tweets, YouTube videos, StackOverflow posts or content from any other site.\n\n### Features\n* Supports all oEmbed providers from [https://oembed.com/](https://oembed.com/) and [https://noembed.com/](https://noembed.com/) by default.\n* Supports the [autodiscovery](https://oembed.com/#section4) part of the oEmbed spec.\n* Support for [Open Graph](https://ogp.me/) protocol.\n* Support for [Twitter Cards](https://developer.twitter.com/en/docs/tweets/optimize-with-cards/overview/abouts-cards.html)\n* Falls back to Meta tags and the site favicon/title if all else fails.\n\n\n## Installation\n\nUse the package manager [pip](https://pip.pypa.io/en/stable/) to install pyunfurl.\n\n```bash\npip install pyunfurl\n```\n\n## Usage\n\n```python\nimport pyunfurl\npyunfurl.unfurl('https://www.youtube.com/watch?v=aBr2kKAHN6M') \n```\nThis will return a dict similar to the oembed spec:\n```\n{\n\t'method': 'oembed', # one of 'oembed', 'twitter_card', 'open_graph', 'meta_tags', 'custom'\n\t'site': 'YouTube', \n\t'domain': 'youtube.com', \n\t'title': 'Live Views of Starman', \n\t'description': '', \n\t'image': '', \n\t'favicon': '', # only included if no image was found \n\t'url': 'https://www.youtube.com/watch?v=aBr2kKAHN6M', \n\t'type': 'rich', \n\t'html': '\\n\\n'\n}\n```\nYou can use the `html` entry to directly include the content on your site.\n\n## Styling\nFor non oembed content (eg OpenGraph entries such as StackOverflow) PyUnfurl returns a html structure like the following:\n```\npyunfurl.unfurl('https://stackoverflow.com/questions/509211/understanding-slice-notation')['html']\n```\n```\n