Tweak OpenGraph

This commit is contained in:
Thomas Sileo
2018-08-05 13:55:48 +02:00
parent 5dce025700
commit 34579bd151
2 changed files with 10 additions and 1 deletions

View File

@@ -42,4 +42,11 @@ def fetch_og_metadata(user_agent, links):
r = requests.get(l, headers={"User-Agent": user_agent}, timeout=15)
r.raise_for_status()
htmls.append(r.text)
return [dict(opengraph.OpenGraph(html=html)) for html in htmls]
res = []
for html in htmls:
data = dict(opengraph.OpenGraph(html=html))
if data.get("url"):
res.append(data)
return res