Backends

class embed_video.backends.SoundCloudBackend(url, is_secure=False)[source]

Backend for SoundCloud URLs.

class embed_video.backends.VideoBackend(url, is_secure=False)[source]

Base backend, good to inherit.

allow_https = True

Sets if HTTPS version allowed for specific backend.

get_embed_code(width, height)[source]

Returns embed code.

get_thumbnail_url()[source]

Returns thumbnail URL folded from pattern_thumbnail_url and parsed code.

get_url()[source]

Returns URL folded from pattern_url and parsed code.

classmethod is_valid(url)[source]

Class method to control if passed url is valid for current backend. By default it is done by re_detect regex.

pattern_thumbnail_url = None

Pattern in which the code is inserted to get thumbnail url.

Example: http://static.myvideo.com/thumbs/%s

pattern_url = None

Pattern in which the code is inserted.

Example: http://myvideo.com?code=%s

re_code = None

Compiled regex (re.compile()) to search code in URL.

Example: re.compile(r'myvideo\.com/\?code=(?P<code>\w+)')

re_detect = None

Compilede regec (re.compile()) to detect, if input URL is valid for current backend.

Example: re.compile(r'^http://myvideo\.com/.*')

class embed_video.backends.VimeoBackend(url, is_secure=False)[source]

Backend for Vimeo URLs.

class embed_video.backends.YoutubeBackend(url, is_secure=False)[source]

Backend for YouTube URLs.

embed_video.backends.detect_backend(url)[source]

Detect the right backend for given URL.