(self, html)
return extracted
Extract data from Facebook Opengraph tags.
Extract data from Facebook Opengraph tags.
Extract data from Facebook Opengraph tags .
def extract(self, html):
        "Extract data from Facebook Opengraph tags."
        extracted = {}
        soup = init_bs(html)
        for meta_tag in soup.find_all('meta'):
            if self.key_attr in meta_tag.attrs and 'content' in meta_tag.attrs:
                property = meta_tag[self.key_attr]
                if property in self.property_map:
                    property_dest = self.property_map[property]
                    if property_dest not in extracted:
                        extracted[property_dest] = []
                    extracted[property_dest].append(meta_tag.attrs['content'])

        return extracted
def extract ( self , html ) : extracted = { } soup = init_bs ( html ) for meta_tag in soup . find_all ( 'meta' ) : if self . key_attr in meta_tag . attrs and 'content' in meta_tag . attrs : property = meta_tag [ self . key_attr ] if property in self . property_map : property_dest = self . property_map [ property ] if property_dest not in extracted : extracted [ property_dest ] = [ ] extracted [ property_dest ] . append ( meta_tag . attrs [ 'content' ] ) return extracted