Python module to parse Open Graph metadata on web pages. For more information on the Open Graph Protocol, see http://ogp.me/.
Fork of HenrikOssipoff/python-opengraph.
Python 3.4+
Other versions may work, but testing is only done against the above versions.
Note the correct name of the fork when installing.
pip install python-opengraph-jaywink
from opengraph import OpenGraph
og = OpenGraph(url="http://someurl.com")
og.title # would yield the "title" open graph element
Any parser supported by BeautifulSoup can be passed in, assuming it is installed.
from opengraph import OpenGraph
og = OpenGraph(url="http://someurl.com", parser="lxml")
from opengraph import OpenGraph
document = '<html><head><meta property="og:title" content="Test title"></head><body></body></html>'
og = OpenGraph(html=document)
Create a Python 3.4+ virtualenv and then:
pip install -r dev-requirements.txt
py.test
MIT
This fork by Jason Robinson (@jaywink / https://jasonrobinson.me).
Original author Henrik Ossipoff Hansen (@HenrikOssipoff).