# -*- coding: utf-8 -*- import logging from markdown.inlinepatterns import Pattern import oembed LOG = logging.getLogger(__name__) OEMBED_LINK_RE = r'\!\[([^\]]*)\]\(((?:https?:)?//[^\)]*)' \ r'(?%s" % html placeholder = self.markdown.htmlStash.store(html) return placeholder def get_oembed_html_for_match(self, match): url = match.group(3).strip() try: response = self.consumer.embed(url) except oembed.OEmbedNoEndpoint: return None except Exception as e: return None else: return response['html']