mirror of
https://github.com/Hopiu/python-markdown-oembed.git
synced 2026-03-17 06:20:24 +00:00
Before this change, only three hardcoded oEmbed endpoints were available for users of the extension; youtube, flickr and vimeo. In the configuration, it was only possible to pass a subset of those 3 oEmbed endpoints. It was done by passing the names of the allowed endpoints. With this change, the API has changed. The allowed_endpoints kwarg now expects to be passed a list of OEmbedEndpoint objects (as opposed to names). This means the responsibility of creating OEmbedEndpoint objects has been shifted to the user of the extension. If the allowed_endpoints kwarg is omitted, the default oEmbed endpoints used will be the same as before; youtube, flickr and vimeo. The motivation is to allow arbitrary oEmbed endpoints, without necessitating anyone to maintain the list of all possible oEmbed endpoints out there.
21 lines
461 B
Python
21 lines
461 B
Python
# -*- coding: utf-8 -*-
|
|
import 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/', [
|
|
'https?://*.flickr.com/*',
|
|
]),
|
|
|
|
# Vimeo
|
|
oembed.OEmbedEndpoint('http://vimeo.com/api/oembed.json', [
|
|
'https?://vimeo.com/*',
|
|
]),
|
|
}
|