Beispiel #1
0
def fetch_and_extract(url):
    data = opengraph.OpenGraph(url=url)
    p = Page()
    p.title = data.get("title", None)
    p.description = data.get("description", None)
    p.canon_url = data.get("url", None)
    p.image_url = data.get("image", None)
    p.ogp_type = data.get("type", None)
    p.fetch_url = data.get("_url", None)
    p.site_name = data.get("site_name", None)
    return p
Beispiel #2
0
 def _pages_from_db_result(self, result):
     for row in result:
         p = Page()
         p.canon_url = row["url"]
         p.title = row["title"]
         p.description = row["description"]
         p.image_url = row["image_url"]
         p.ogp_type = row["ogp_type"]
         p.site_name = row["site_name"]
         yield p
 def _pages_from_db_result(self, result):
     for row in result:
         p = Page()
         p.canon_url = row["url"]
         p.title = row["title"]
         p.description = row["description"]
         p.image_url = row["image_url"]
         p.ogp_type = row["ogp_type"]
         p.site_name = row["site_name"]
         yield p