mirror of
https://github.com/Hopiu/python-markdown-oembed.git
synced 2026-03-16 22:10:24 +00:00
Update inlinepatterns.py
This commit is contained in:
parent
cb46ae8f8a
commit
e5d64d6853
1 changed files with 4 additions and 0 deletions
|
|
@ -19,6 +19,7 @@ class OEmbedLinkPattern(Pattern):
|
||||||
|
|
||||||
def handleMatch(self, match):
|
def handleMatch(self, match):
|
||||||
html = self.get_oembed_html_for_match(match)
|
html = self.get_oembed_html_for_match(match)
|
||||||
|
LOG.info(html)
|
||||||
if html is None:
|
if html is None:
|
||||||
return None
|
return None
|
||||||
else:
|
else:
|
||||||
|
|
@ -28,11 +29,14 @@ class OEmbedLinkPattern(Pattern):
|
||||||
|
|
||||||
def get_oembed_html_for_match(self, match):
|
def get_oembed_html_for_match(self, match):
|
||||||
url = match.group(3).strip()
|
url = match.group(3).strip()
|
||||||
|
LOG.info(url)
|
||||||
try:
|
try:
|
||||||
response = self.consumer.embed(url)
|
response = self.consumer.embed(url)
|
||||||
except oembed.OEmbedNoEndpoint:
|
except oembed.OEmbedNoEndpoint:
|
||||||
|
LOG.error("No OEmbed Endpoint")
|
||||||
return None
|
return None
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
LOG.error(e)
|
||||||
return None
|
return None
|
||||||
else:
|
else:
|
||||||
return response['html']
|
return response['html']
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue