GData.YouTubeService¶
- Subclasses:
None
Methods¶
- Inherited:
GData.Service (27), GObject.Object (37), GData.Batchable (1)
- Structs:
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
- Inherited:
Name |
Type |
Flags |
Short Description |
|---|---|---|---|
r/w/co |
Your YouTube developer API key. |
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
|---|---|---|---|
parent |
r |
Class Details¶
- class GData.YouTubeService(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
All the fields in the
GData.YouTubeServicestructure are private and should never be accessed directly.- classmethod get_primary_authorization_domain()¶
- Returns:
the service’s authorization domain
- Return type:
The primary
GData.AuthorizationDomainfor interacting with YouTube. This will not normally need to be used, as it’s used internally by theGData.YouTubeServicemethods. However, if using the plainGData.Servicemethods to implement custom queries or requests which libgdata does not support natively, then this domain may be needed to authorize the requests.The domain never changes, and is interned so that pointer comparison can be used to differentiate it from other authorization domains.
New in version 0.9.0.
- classmethod new(developer_key, authorizer)¶
- Parameters:
developer_key (
str) – your application’s developer API keyauthorizer (
GData.AuthorizerorNone) – aGData.Authorizerto authorize the service’s requests, orNone
- Returns:
a new
GData.YouTubeService, orNone; unref withGObject.Object.unref()- Return type:
Creates a new
GData.YouTubeServiceusing the givenGData.Authorizer. If authorizer isNone, all requests are made as an unauthenticated user. The developer_key must be unique for your application, and asNew in version 0.9.0.
- finish_video_upload(upload_stream)¶
- Parameters:
upload_stream (
GData.UploadStream) – theGData.UploadStreamfrom the operation- Raises:
- Returns:
the new
GData.YouTubeVideo, orNone; unref withGObject.Object.unref()- Return type:
Finish off a video upload operation started by
GData.YouTubeService.upload_video(), parsing the result and returning the newGData.YouTubeVideo.If an error occurred during the upload operation, it will have been returned during the operation (e.g. by
Gio.OutputStream.splice() or one of the other stream methods). In such a case,Nonewill be returned but error will remain unset. error is only set in the case that the server indicates that the operation was successful, but an error is encountered in parsing the result sent by the server.New in version 0.8.0.
- get_categories(cancellable)¶
- Parameters:
cancellable (
Gio.CancellableorNone) – aGio.Cancellable, orNone- Raises:
- Returns:
a
GData.APPCategories, orNone; unref withGObject.Object.unref()- Return type:
Gets a list of the categories currently in use on YouTube. The returned
GData.APPCategoriescontains a list ofGData.YouTubeCategoryswhich enumerate the current YouTube categories.The category labels (
GData.Category:label) are localised based on the value ofGData.Service:locale.New in version 0.7.0.
- get_categories_async(cancellable, callback, *user_data)¶
- Parameters:
cancellable (
Gio.CancellableorNone) – optionalGio.Cancellableobject, orNonecallback (
Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is finisheduser_data (
objectorNone) – data to pass to the callback function
Gets a list of the categories currently in use on YouTube. self is reffed when this function is called, so can safely be unreffed after this function returns.
For more details, see
GData.YouTubeService.get_categories(), which is the synchronous version of this function.When the operation is finished, callback will be called. You can then call
GData.YouTubeService.get_categories_finish() to get the results of the operation.New in version 0.7.0.
- get_categories_finish(async_result)¶
- Parameters:
async_result (
Gio.AsyncResult) – aGio.AsyncResult- Raises:
- Returns:
a
GData.APPCategories, orNone; unref withGObject.Object.unref()- Return type:
Finishes an asynchronous request for a list of categories on YouTube, as started with
GData.YouTubeService.get_categories_async().New in version 0.7.0.
- get_developer_key()¶
- Returns:
the developer key property
- Return type:
Gets the
GData.YouTubeService:developer-keyproperty from theGData.YouTubeService.
- Parameters:
video (
GData.YouTubeVideo) – aGData.YouTubeVideofor which to find related videosquery (
GData.QueryorNone) – aGData.Querywith the query parameters, orNonecancellable (
Gio.CancellableorNone) – optionalGio.Cancellableobject, orNoneprogress_callback (
GData.QueryProgressCallbackorNone) – aGData.QueryProgressCallbackto call when an entry is loaded, orNoneprogress_user_data (
objectorNone) – data to pass to the progress_callback function
- Raises:
- Returns:
a
GData.Feedof query results; unref withGObject.Object.unref()- Return type:
Queries the service for videos related to video. The algorithm determining which videos are related is on the server side.
Parameters and other errors are as for
GData.Service.query().
- Parameters:
video (
GData.YouTubeVideo) – aGData.YouTubeVideofor which to find related videosquery (
GData.QueryorNone) – aGData.Querywith the query parameters, orNonecancellable (
Gio.CancellableorNone) – optionalGio.Cancellableobject, orNoneprogress_callback (
GData.QueryProgressCallbackorNone) – aGData.QueryProgressCallbackto call when an entry is loaded, orNoneprogress_user_data (
objectorNone) – data to pass to the progress_callback functioncallback (
Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when authentication is finisheduser_data (
objectorNone) – data to pass to the callback function
Queries the service for videos related to video. The algorithm determining which videos are related is on the server side. self and query are both reffed when this function is called, so can safely be freed after this function returns.
For more details, see
GData.YouTubeService.query_related(), which is the synchronous version of this function.When the operation is finished, callback will be called. You can then call
GData.Service.query_finish() to get the results of the operation.New in version 0.9.1.
- query_standard_feed(feed_type, query, cancellable, progress_callback, *progress_user_data)¶
- Parameters:
feed_type (
GData.YouTubeStandardFeedType) – the feed type to query, fromGData.YouTubeStandardFeedTypequery (
GData.QueryorNone) – aGData.Querywith the query parameters, orNonecancellable (
Gio.CancellableorNone) – optionalGio.Cancellableobject, orNoneprogress_callback (
GData.QueryProgressCallbackorNone) – aGData.QueryProgressCallbackto call when an entry is loaded, orNoneprogress_user_data (
objectorNone) – data to pass to the progress_callback function
- Raises:
- Returns:
a
GData.Feedof query results, orNone; unref withGObject.Object.unref()- Return type:
Queries the service’s standard feed_type feed to build a
GData.Feed.Note that with the port from v2 to v3 of the YouTube API in libgdata 0.17.0, all feed types except
GData.YouTubeStandardFeedType.MOST_POPULAR_FEEDhave been deprecated. Other feed types will now transparently returnGData.YouTubeStandardFeedType.MOST_POPULAR_FEED, limited to the past 24 hours.Parameters and errors are as for
GData.Service.query().
- query_standard_feed_async(feed_type, query, cancellable, progress_callback, progress_user_data, callback, *user_data)¶
- Parameters:
feed_type (
GData.YouTubeStandardFeedType) – the feed type to query, fromGData.YouTubeStandardFeedTypequery (
GData.QueryorNone) – aGData.Querywith the query parameters, orNonecancellable (
Gio.CancellableorNone) – optionalGio.Cancellableobject, orNoneprogress_callback (
GData.QueryProgressCallbackorNone) – aGData.QueryProgressCallbackto call when an entry is loaded, orNoneprogress_user_data (
objectorNone) – data to pass to the progress_callback functioncallback (
Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when authentication is finisheduser_data (
objectorNone) – data to pass to the callback function
Queries the service’s standard feed_type feed to build a
GData.Feed. self and query are both reffed when this function is called, so can safely be freed after this function returns.For more details, see
GData.YouTubeService.query_standard_feed(), which is the synchronous version of this function.When the operation is finished, callback will be called. You can then call
GData.Service.query_finish() to get the results of the operation.New in version 0.9.1.
- query_videos(query, cancellable, progress_callback, *progress_user_data)¶
- Parameters:
query (
GData.QueryorNone) – aGData.Querywith the query parameters, orNonecancellable (
Gio.CancellableorNone) – optionalGio.Cancellableobject, orNoneprogress_callback (
GData.QueryProgressCallbackorNone) – aGData.QueryProgressCallbackto call when an entry is loaded, orNoneprogress_user_data (
objectorNone) – data to pass to the progress_callback function
- Raises:
- Returns:
a
GData.Feedof query results, orNone; unref withGObject.Object.unref()- Return type:
Queries the service for videos matching the parameters set on the
GData.Query. This searches site-wide, and imposes no other restrictions or parameters on the query.Parameters and errors are as for
GData.Service.query().
- query_videos_async(query, cancellable, progress_callback, progress_user_data, callback, *user_data)¶
- Parameters:
query (
GData.QueryorNone) – aGData.Querywith the query parameters, orNonecancellable (
Gio.CancellableorNone) – optionalGio.Cancellableobject, orNoneprogress_callback (
GData.QueryProgressCallbackorNone) – aGData.QueryProgressCallbackto call when an entry is loaded, orNoneprogress_user_data (
objectorNone) – data to pass to the progress_callback functioncallback (
Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when authentication is finisheduser_data (
objectorNone) – data to pass to the callback function
Queries the service for videos matching the parameters set on the
GData.Query. This searches site-wide, and imposes no other restrictions or parameters on the query. self and query are both reffed when this function is called, so can safely be freed after this function returns.For more details, see
GData.YouTubeService.query_videos(), which is the synchronous version of this function.When the operation is finished, callback will be called. You can then call
GData.Service.query_finish() to get the results of the operation.New in version 0.9.1.
- upload_video(video, slug, content_type, cancellable)¶
- Parameters:
video (
GData.YouTubeVideo) – aGData.YouTubeVideoto insertslug (
str) – the filename to give to the uploaded filecontent_type (
str) – the content type of the uploaded datacancellable (
Gio.CancellableorNone) – aGio.Cancellablefor the entire upload stream, orNone
- Raises:
- Returns:
a
GData.UploadStreamto write the video data to, orNone; unref withGObject.Object.unref()- Return type:
Uploads a video to YouTube, using the properties from video and the file data written to the resulting
GData.UploadStream.If video has already been inserted, a
GData.ServiceError.ENTRY_ALREADYSERTEDerror will be returned. If no user is authenticated with the service,GData.ServiceError.AUTHENTICATION_REQUIREDwill be returned.The stream returned by this function should be written to using the standard
Gio.OutputStreammethods, asynchronously or synchronously. Once the stream is closed (usingGio.OutputStream.close()),GData.YouTubeService.finish_video_upload() should be called on it to parse and return the updatedGData.YouTubeVideofor the uploaded video. This must be done, as video isn’t updated in-place.In order to cancel the upload, a
Gio.Cancellablepassed in to cancellable must be cancelled usingGio.Cancellable.cancel(). Cancelling the individualGio.OutputStreamoperations on theGData.UploadStreamwill not cancel the entire upload; merely the write or close operation in question. See theGData.UploadStream:cancellablefor more details.Any upload errors will be thrown by the stream methods, and may come from the
GData.ServiceErrordomain.New in version 0.8.0.
Property Details¶
- GData.YouTubeService.props.developer_key¶
- Name:
developer-key- Type:
- Default Value:
- Flags:
The developer key your application has registered with the YouTube API. For more information, see the online documentation.
With the port from v2 to v3 of the YouTube API in libgdata 0.17.0, it might be necessary to update your application’s developer key.