erikriver / opengraph

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

Duplicate data #28

Open raks8877 opened 7 years ago

raks8877 commented 7 years ago

Ran these command in ipython:

from opengraph import OpenGraph og=OpenGraph("http://www.livemint.com/Industry/VlSovF4AGkwhupYQ2Ps3YN/Bschool-placements-Modest-rise-in-average-salary-offered.html") og

og=OpenGraph("http://facebook.com") og

output1: {'locale:alternate': 'ja_JP', 'site_name': 'http://www.livemint.com/', 'description': 'Initial analysis of the ongoing placement season at IIMs and other top B-schools indicate that most salaries offered show a single digit growth over last year', 'title': 'B-school placements see modest salary growth, fewer offers from start-ups', 'url': 'http://www.livemint.com/Industry/VlSovF4AGkwhupYQ2Ps3YN/Bschool-placements-Modest-rise-in-average-salary-offered.html', 'image': 'http://www.livemint.com/rf/Image-621x414/LiveMint/Period2/2017/02/08/Photos/Processed/iima-klWE--621x414@LiveMint.jpg', 'locale': 'hi_IN', 'type': 'article'}

output2: {'locale:alternate': 'ja_JP', 'site_name': 'Facebook', 'description': 'Initial analysis of the ongoing placement season at IIMs and other top B-schools indicate that most salaries offered show a single digit growth over last year', 'title': 'B-school placements see modest salary growth, fewer offers from start-ups', 'url': 'https://www.facebook.com/', 'image': 'https://www.facebook.com/images/fb_icon_325x325.png', 'locale': 'hi_IN', 'type': 'article'}

description and title are same.

n4ru commented 7 years ago

+1

OpenGraph isn't clearing the cached data each time.

n4ru commented 7 years ago

As a workaround, you can manually reset the data object before you call it after the first time.

OpenGraph.__data__ = {}

raks8877 commented 7 years ago

Thanks for the help.