erikriver / opengraph

A python module to parse the Open Graph Protocol
http://ogp.me/
MIT License
226 stars 82 forks source link

Added support for other OpenGraph like tags #9

Open daryltucker opened 10 years ago

daryltucker commented 10 years ago

Twitter and OpenGraph have been split apart. I made all attempts to respect OpenGraph as the default provider, while allowing either to be used very easily.

Each 'Provider' can have different required attributes, as well as the attribute we key off of for finding these tags.

Passing provider to OpenGraph() will force a Provider. If any OpenGraph tags are found, OpenGraph becomes the Provider, which forces validity of OpenGraph instead of the original Provider.

is_valid() has been modified such that it will use the detected Provider. If tags of mixed providers are found, OpenGraph will take precedence.

to_html() has been altered to print using the Provider's name.

OrderedDict from collections is used to keep OpenGraph as top priority.

daryltucker commented 10 years ago

I'm not sure if you ever wanted to support other Providers, but I figured I'd share the code with you. Thanks for writing opengraph :D