Backends

class embed_video.backends.SoundCloudBackend(url)[source]

Backend for SoundCloud URLs.

class embed_video.backends.VideoBackend(url)[source]

Base backend, good to inherit.

get_code()[source]

Returns searched code from URL by re_code.

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.

init(url)[source]

Load all data (get_code(), get_url() etc.)

classmethod is_valid(klass, 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)[source]

Backend for Vimeo URLs.

class embed_video.backends.YoutubeBackend(url)[source]

Backend for YouTube URLs.

embed_video.backends.detect_backend(url)[source]

Detect the right backend for given URL.

Previous topic

Admin

Next topic

Fields

This Page