# Class e.p.y.r.YoutubeResourceProvider(ResourceProvider):

Part of elisa.plugins.youtube.resource_provider View In Hierarchy

A resource provider that implements the GET method for use on the Youtube API (see http://code.google.com/apis/youtube/developers_guide_protocol.html for details).

The GET method allows to retrieve lists of videos using the Youtube API feeds, or directly a given video from its Youtube id, or an image thumbnail for a video.

Line # | Kind | Name | Docs
--- | --- | --- | ---
74 | Method | initialize | Initialize the component.
81 | Method | clean | Clean the component.
88 | Method | get | GET request to the Youtube servers.
197 | Method | post | POST request to the Youtube servers.

Inherited from ResourceProvider:

Line # | Kind | Name | Docs
--- | --- | --- | ---
107 | Method | put | Put one resource into another. Both resources are identified with URIs.
129 | Method | delete | Delete a Resource represented by a URI.

Inherited from Component (via ResourceProvider):

Line # | Kind | Name | Docs
--- | --- | --- | ---
85 | Class | PathDescriptor | Undocumented
97 | Class Method | create | Create and initialize the component.

Inherited from Loggable (via ResourceProvider, Component):

Line # | Kind | Name | Docs
--- | --- | --- | ---
81 | Method | __init__ | Undocumented

def initialize(self):
overrides elisa.core.component.Component.initialize

Initialize the component.

This method is called by `Component.create` to finish the initialization of a component.

Returns | a deferred called when a component is fully initialized (type: `twisted.internet.defer.Deferred` )

def clean(self):
overrides elisa.core.component.Component.clean

Clean the component.

This method is called when a component is not needed anymore to clean its state.

Returns | a deferred called when the component has finished cleaning its state (type: `twisted.internet.defer.Deferred` )

def get(self, uri, context_model=None):
overrides elisa.core.components.resource_provider.ResourceProvider.get

GET request to the Youtube servers.

It accepts the following types of URLs:

- http://gdata.youtube.com/feeds/api/.* : query to the video feeds of the Youtube API, returns a list of videos (`elisa.plugins.youtube.models.YoutubeVideoListModel`). For a complete list of available feeds, see http://code.google.com/apis/youtube/developers_guide_protocol.html#Standard_feeds
- http://www.youtube.com/watch?v=.* : query to the Youtube server for a given video, returns the playable URL of the SWF video file (`elisa.plugins.base.models.media.PlayableModel`).
- http://img.youtube.com/vi/.*.jpg : query to the Youtube image server for a video thumbnail, returns the image data (`elisa.plugins.base.models.media.RawDataModel`).

The contextual model is used when querying for the playable URL of a video, if present it should be a `elisa.plugins.youtube.models.YoutubeVideoModel`. Its `playable_model` will then be set to the retrieved model.

def post(self, uri, **parameters):
overrides elisa.core.components.resource_provider.ResourceProvider.post

POST request to the Youtube servers.

DOCME (not implemented yet)