diff --git a/mdx_oembed/endpoints.py b/mdx_oembed/endpoints.py index ce0a0d6..0fd23ba 100644 --- a/mdx_oembed/endpoints.py +++ b/mdx_oembed/endpoints.py @@ -2,15 +2,20 @@ import oembed -ENDPOINTS = { - 'youtube': oembed.OEmbedEndpoint('http://www.youtube.com/oembed', [ +DEFAULT_ENDPOINTS = [ + # Youtube + oembed.OEmbedEndpoint('http://www.youtube.com/oembed', [ 'https?://(*.)?youtube.com/*', 'https?://youtu.be/*', ]), - 'flickr': oembed.OEmbedEndpoint('http://www.flickr.com/services/oembed/', [ + + # Flickr + oembed.OEmbedEndpoint('http://www.flickr.com/services/oembed/', [ 'https?://*.flickr.com/*', ]), - 'vimeo': oembed.OEmbedEndpoint('http://vimeo.com/api/oembed.json', [ + + # Vimeo + oembed.OEmbedEndpoint('http://vimeo.com/api/oembed.json', [ 'https?://vimeo.com/*', ]), } diff --git a/mdx_oembed/extension.py b/mdx_oembed/extension.py index 9ad8ee1..b3916fa 100644 --- a/mdx_oembed/extension.py +++ b/mdx_oembed/extension.py @@ -1,21 +1,18 @@ # -*- coding: utf-8 -*- from markdown import Extension import oembed -from mdx_oembed.endpoints import ENDPOINTS +from mdx_oembed.endpoints import DEFAULT_ENDPOINTS from mdx_oembed.inlinepatterns import OEmbedLinkPattern, OEMBED_LINK_RE -AVAILABLE_ENDPOINTS = ENDPOINTS.keys() - - class OEmbedExtension(Extension): def __init__(self, **kwargs): self.config = { 'allowed_endpoints': [ - AVAILABLE_ENDPOINTS, - "A list of oEmbed endpoints to allow. Possible values are " - "{}.".format(', '.join(AVAILABLE_ENDPOINTS)), + DEFAULT_ENDPOINTS, + "A list of oEmbed endpoints to allow. Defaults to " + "endpoints.DEFAULT_ENDPOINTS" ], } super(OEmbedExtension, self).__init__(**kwargs) @@ -27,10 +24,11 @@ class OEmbedExtension(Extension): md.inlinePatterns.add('oembed_link', link_pattern, '