{ "info": { "author": "ludbek", "author_email": "sth.srn@gmail.com", "bugtrack_url": null, "classifiers": [ "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "[](https://travis-ci.org/ludbek/webpreview)\n\n# About\nWebpreview helps preview a webpage. It extracts [Open Graph](http://ogp.me/), [Twitter Card](https://dev.twitter.com/cards/overview) and [Schema](http://schema.org/) meta tags. Given a URL of a page, it extracts title, thumbnail, description, etc as per request.\n\n#Installation\n\n $ pip install webpreview\n\n#Usage\n## Preview a Web Page\nAPI: `web_preview(url, timeout?, headers?, content?, absolute_image_url?, parser?)`\n\nUse `web_preview` for extracting title, description and thumbnail image. It tries to extract them from Open Graph properties, if not found it falls back to Twitter Card, and so on till Schema. If non works it tries to extract from the webpage's content.\n\n $ from webpreview import web_preview\n $ title, description, image = web_preview(\"aurl.com\")\n\n # specifing timeout which gets passed to requests.get()\n $ title, description, image = web_preview(\"a_slow_url.com\", timeout=1000)\n\n # passing headers\n $ headers = {'User-Agent': 'Mozilla/5.0'}\n $ title, description, image = web_preview(\"a_slow_url.com\", headers=headers)\n\n # pass html content thus avoiding making http call again to fetch content.\n $ content = \"\"\"