def validate_and_extract(self, node: bs4.element): """Validates if a tag is instagram post tag and returns the extracted data from the tag in EInstagramPost object""" if isinstance(node, bs4.element.Tag): if node.has_attr('class') \ and ('instagram-media' in node['class'] or 'instagram-media-rendered' in node['class']): return EInstagramPost(self. __get_instagram_shortcode (node.find('a')['href'])) if node.name == 'iframe' \ and node.has_attr('src') \ and utils.has_domain(node['src'], r'^https://instagram\.com/'): return EInstagramPost(self. __get_instagram_shortcode (node['src'])) return None
def get_url(self, product_element: element) -> str: return product_element.find("a")['href']
def get_image(self, product_element: element) -> str: return product_element.find("img")['src']