erikriver / opengraph

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

Make it possible to specify the parser for BeautifulSoup4 #39

Open fumiya5863 opened 2 years ago

fumiya5863 commented 2 years ago

If you have lxml installed, BeautifulSoup4 will set lxml as the default parser, so it would be better to be able to specify the parser depending on the situation. https://github.com/erikriver/opengraph/blob/e2322563004c923a4c1ce136733a44efe5fc8caa/opengraph/opengraph.py#L63 This is the default setting because we didn't actually do the parser above.

Depending on the environment, the following issue cases may occur due to the above reasons https://github.com/erikriver/opengraph/issues/37

As a solution, I think it would be a good idea to add a new parser that can be selected in the following arguments https://github.com/erikriver/opengraph/blob/e2322563004c923a4c1ce136733a44efe5fc8caa/opengraph/opengraph.py#L28