GData.YouTubeVideo

g GData.Commentable GData.Commentable GData.YouTubeVideo GData.YouTubeVideo GData.Commentable->GData.YouTubeVideo GData.Entry GData.Entry GData.Entry->GData.YouTubeVideo GData.Parsable GData.Parsable GData.Parsable->GData.Entry GObject.GInterface GObject.GInterface GObject.GInterface->GData.Commentable GObject.Object GObject.Object GObject.Object->GData.Parsable

Subclasses:

None

Methods

Inherited:

GData.Entry (24), GData.Parsable (5), GObject.Object (37), GData.Commentable (9)

Structs:

GObject.ObjectClass (5)

class

get_video_id_from_uri (video_uri)

class

new (id)

get_access_control (action)

get_aspect_ratio ()

get_category ()

get_coordinates ()

get_credit ()

get_description ()

get_duration ()

get_favorite_count ()

get_keywords ()

get_location ()

get_media_rating (rating_type)

get_player_uri ()

get_rating ()

get_recorded ()

get_state ()

get_thumbnails ()

get_uploaded ()

get_video_id ()

get_view_count ()

is_draft ()

is_private ()

is_restricted_in_country (country)

look_up_content (type)

set_access_control (action, permission)

set_aspect_ratio (aspect_ratio)

set_category (category)

set_coordinates (latitude, longitude)

set_description (description)

set_is_draft (is_draft)

set_is_private (is_private)

set_keywords (keywords)

set_location (location)

set_recorded (recorded)

Virtual Methods

Inherited:

GData.Parsable (9), GObject.Object (7), GData.Commentable (3)

Properties

Inherited:

GData.Entry (10), GData.Parsable (1)

Name

Type

Flags

Short Description

aspect-ratio

str

r/w

The aspect ratio of the video.

average-rating

float

r

The average rating of the video.

category

GData.MediaCategory

r/w

Specifies a genre or developer tag that describes the video.

credit

GData.YouTubeCredit

d/r

Identifies the owner of the video. deprecated

description

str

r/w

A summary or description of the video.

duration

int

r

The duration of the video in seconds.

favorite-count

int

r

The number of users who have added the video to their favorites.

is-draft

bool

d/r/w

Indicates whether the video is in draft, or unpublished, status. deprecated

is-private

bool

r/w

Indicates whether the video is private.

keywords

[str]

r/w

A None-terminated array of words associated with the video.

latitude

float

r/w

The location as a latitude coordinate associated with this video.

location

str

r/w

Descriptive text about the location where the video was taken.

longitude

float

r/w

The location as a longitude coordinate associated with this video.

max-rating

int

r

The maximum allowed rating for the video.

min-rating

int

r

The minimum allowed rating for the video.

player-uri

str

r

A URI for a browser-based media player for the full-length video.

rating-count

int

r

The number of times the video has been rated.

recorded

int

r/w

Specifies the time the video was originally recorded.

state

GData.YouTubeState

r

Information describing the state of the video.

uploaded

int

r

Specifies the time the video was originally uploaded to YouTube.

video-id

str

d/r

Specifies a unique ID which YouTube uses to identify the video. deprecated

view-count

int

r

The number of times the video has been viewed.

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

GData.Entry

r

Class Details

class GData.YouTubeVideo(**kwargs)
Bases:

GData.Entry, GData.Commentable

Abstract:

No

Structure:

GData.YouTubeVideoClass

All the fields in the GData.YouTubeVideo structure are private and should never be accessed directly.

classmethod get_video_id_from_uri(video_uri)
Parameters:

video_uri (str) – a YouTube video player URI

Returns:

the video ID, or None; free with GLib.free()

Return type:

str

Extracts a video ID from a YouTube video player URI. The video ID is in the same form as returned by GData.YouTubeVideo.get_video_id(), and the video_uri should be in the same form as returned by GData.YouTubeVideo.get_player_uri().

The function will validate whether the URI actually points to a hostname containing <literal>youtube</literal> (e.g. <literal>youtube.com</literal>), and will return None if it doesn’t.

For example: <informalexample><programlisting> video_id = GData.YouTubeVideo.get_video_id_from_uri (“http://www.youtube.com/watch?v=BH_vwsyCrTc&feature=featured”); g_message (“Video ID: %s”, video_id); /<!– –>* Should print: BH_vwsyCrTc *<!– –>/ GLib.free (video_id); </programlisting></informalexample>

New in version 0.4.0.

classmethod new(id)
Parameters:

id (str or None) – the video’s ID, or None

Returns:

a new GData.YouTubeVideo; unref with GObject.Object.unref()

Return type:

GData.YouTubeVideo

Creates a new GData.YouTubeVideo with the given ID and default properties.

get_access_control(action)
Parameters:

action (str) – the action whose permission should be returned

Returns:

the permission associated with action, or GData.YouTubePermission.DENIED

Return type:

GData.YouTubePermission

Gets the permission associated with the given action on the GData.YouTubeVideo. If the given action doesn’t have a permission set on the video, GData.YouTubePermission.DENIED is returned.

New in version 0.7.0.

get_aspect_ratio()
Returns:

the aspect ratio property, or None

Return type:

str

Gets the GData.YouTubeVideo :aspect-ratio property.

New in version 0.4.0.

get_category()
Returns:

a GData.MediaCategory giving the video’s single and mandatory category

Return type:

GData.MediaCategory

Gets the GData.YouTubeVideo :category property.

get_coordinates()
Returns:

latitude:

return location for the latitude, or None

longitude:

return location for the longitude, or None

Return type:

(latitude: float, longitude: float)

Gets the GData.YouTubeVideo :latitude and GData.YouTubeVideo :longitude properties, setting the out parameters to them. If either latitude or longitude is None, that parameter will not be set. If the coordinates are unset, latitude and longitude will be set to GObject.G_MAXDOUBLE.

New in version 0.8.0.

get_credit()
Returns:

a GData.MediaCredit giving information on whom to credit for the video, or None

Return type:

GData.YouTubeCredit

Gets the GData.YouTubeVideo :credit property.

Deprecated since version 0.17.0: This is no longer supported by Google, and will always return None. There is no replacement.

get_description()
Returns:

the video’s long text description, or None

Return type:

str

Gets the GData.YouTubeVideo :description property.

get_duration()
Returns:

the video duration in seconds, or 0 if unknown

Return type:

int

Gets the GData.YouTubeVideo :duration property.

get_favorite_count()
Returns:

the number of users who have added the video to their favorites list

Return type:

int

Gets the GData.YouTubeVideo :favorite-count property.

get_keywords()
Returns:

a None-terminated array of words associated with the video

Return type:

[str]

Gets the GData.YouTubeVideo :keywords property.

get_location()
Returns:

a string describing the video’s location, or None

Return type:

str

Gets the GData.YouTubeVideo :location property.

get_media_rating(rating_type)
Parameters:

rating_type (str) – the type of rating to retrieve

Returns:

the rating of the video for the given rating_type, or None if the video isn’t rated with that type (or the type is unknown)

Return type:

str

Returns the rating of the given type for the video, if one exists. For example, this could be a film rating awarded by the MPAA; or a simple rating specifying whether the video contains adult content.

The valid values for rating_type are: GData.YOUTUBE_RATING_TYPE_MPAA and GData.YOUTUBE_RATING_TYPE_V_CHIP. Further values may be added in future; if an unknown rating type is passed to the function, None will be returned.

The possible return values depend on what’s passed to rating_type. Valid values for each rating type are listed in the documentation for the rating types.

New in version 0.10.0.

get_player_uri()
Returns:

a URI where the video is playable in a web browser, or None

Return type:

str

Gets the GData.YouTubeVideo :player-uri property.

get_rating()
Returns:

min:

return location for the minimum rating value, or None

max:

return location for the maximum rating value, or None

count:

return location for the number of ratings, or None

average:

return location for the average rating value, or None

Return type:

(min: int, max: int, count: int, average: float)

Gets various properties of the ratings on the video.

Note that this property may not be retrieved when querying for multiple videos at once, but is guaranteed to be retrieved when querying with GData.Service.query_single_entry_async().

get_recorded()
Returns:

the UNIX timestamp for the time the video was recorded, or -1

Return type:

int

Gets the GData.YouTubeVideo :recorded property. If the property is unset, -1 will be returned.

New in version 0.3.0.

get_state()
Returns:

a GData.YouTubeState showing the state of the video, or None

Return type:

GData.YouTubeState

Gets the GData.YouTubeVideo :state property.

For more information, see the online documentation.

get_thumbnails()
Returns:

a GLib.List of GData.MediaThumbnails, or None

Return type:

[GData.MediaThumbnail]

Gets a list of the thumbnails available for the video.

get_uploaded()
Returns:

the UNIX timestamp for the time the video was uploaded, or -1

Return type:

int

Gets the GData.YouTubeVideo :uploaded property. If the property is unset, -1 will be returned.

get_video_id()
Returns:

the video’s unique and permanent ID

Return type:

str

Gets the GData.YouTubeVideo :video-id property.

Deprecated since version 0.17.0: This is now equal to GData.Entry :id.

get_view_count()
Returns:

the number of times the video has been viewed

Return type:

int

Gets the GData.YouTubeVideo :view-count property.

is_draft()
Returns:

True if the video is a draft, False otherwise

Return type:

bool

Gets the GData.YouTubeVideo :is-draft property.

Deprecated since version 0.17.0: This is now equal to GData.YouTubeVideo.is_private().

is_private()
Returns:

True if the video is private, False otherwise

Return type:

bool

Gets the GData.YouTubeVideo :is-private property.

is_restricted_in_country(country)
Parameters:

country (str) – an ISO 3166 two-letter country code to check

Returns:

True if the video is restricted in country, False otherwise

Return type:

bool

Checks whether viewing of the video is restricted in country, either by its content rating, or by the request of the producer. The return value from this function is purely informational, and no obligation is assumed.

New in version 0.4.0.

look_up_content(type)
Parameters:

type (str) – the MIME type of the content desired

Returns:

a GData.YouTubeContent matching type, or None

Return type:

GData.YouTubeContent

Looks up a GData.YouTubeContent from the video with the given MIME type. The video’s list of contents is a list of URIs to various formats of the video itself, such as its SWF URI or RTSP stream.

Deprecated since version 0.17.0: This is no longer supported by Google, and will always return None. To view a video, open the URI returned by GData.YouTubeVideo.get_player_uri() in a web browser.

set_access_control(action, permission)
Parameters:
  • action (str) – the action whose permission is being set

  • permission (GData.YouTubePermission) – the permission to give to the action

Sets the permission associated with action on the GData.YouTubeVideo, allowing restriction or derestriction of various operations on YouTube videos.

Note that only GData.YOUTUBE_ACTION_RATE and GData.YOUTUBE_ACTION_COMMENT actions can have the GData.YouTubePermission.MODERATED permission.

New in version 0.7.0.

set_aspect_ratio(aspect_ratio)
Parameters:

aspect_ratio (str or None) – the aspect ratio property, or None

Sets the GData.YouTubeVideo :aspect-ratio property to specify the video’s aspect ratio. If aspect_ratio is None, the property will be unset.

New in version 0.4.0.

set_category(category)
Parameters:

category (GData.MediaCategory) – a new GData.MediaCategory

Sets the GData.YouTubeVideo :category property to the new category, category, and increments its reference count.

category must not be None. For more information, see the online documentation.

set_coordinates(latitude, longitude)
Parameters:

Sets the GData.YouTubeVideo :latitude and GData.YouTubeVideo :longitude properties to latitude and longitude respectively.

New in version 0.8.0.

set_description(description)
Parameters:

description (str or None) – the video’s new description, or None

Sets the GData.YouTubeVideo :description property to the new description, description.

Set description to None to unset the video’s description.

set_is_draft(is_draft)
Parameters:

is_draft (bool) – whether the video is a draft

Sets the GData.YouTubeVideo :is-draft property to decide whether the video is a draft.

Deprecated since version 0.17.0: This is now equivalent to GData.YouTubeVideo.set_is_private().

set_is_private(is_private)
Parameters:

is_private (bool) – whether the video is private

Sets the GData.YouTubeVideo :is-private property to decide whether the video is publicly viewable.

set_keywords(keywords)
Parameters:

keywords ([str]) – a new None-terminated array of keywords

Sets the GData.YouTubeVideo :keywords property to the new keyword list, keywords.

keywords must not be None. For more information, see the online documentation.

set_location(location)
Parameters:

location (str or None) – a new location, or None

Sets the GData.YouTubeVideo :location property to the new location string, location.

Set location to None to unset the property in the video.

set_recorded(recorded)
Parameters:

recorded (int) – the video’s new recorded time, or -1

Sets the GData.YouTubeVideo :recorded property to the new recorded time, recorded.

Set recorded to -1 to unset the video’s recorded time.

New in version 0.3.0.

Property Details

GData.YouTubeVideo.props.aspect_ratio
Name:

aspect-ratio

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

The aspect ratio of the video. A None value means the aspect ratio is unknown (it could still be a widescreen video). A value of GData.YOUTUBE_ASPECT_RATIO_WIDESCREEN means the video is definitely widescreen.

New in version 0.4.0.

GData.YouTubeVideo.props.average_rating
Name:

average-rating

Type:

float

Default Value:

0.0

Flags:

READABLE

The average rating of the video, over all the ratings it’s received.

For more information, see the online documentation.

GData.YouTubeVideo.props.category
Name:

category

Type:

GData.MediaCategory

Default Value:

None

Flags:

READABLE, WRITABLE

Specifies a genre or developer tag that describes the video.

For more information, see the online documentation.

GData.YouTubeVideo.props.credit
Name:

credit

Type:

GData.YouTubeCredit

Default Value:

None

Flags:

DEPRECATED, READABLE

Identifies the owner of the video.

Deprecated since version 0.17.0: This is no longer supported by Google, and will always be None. There is no replacement.

GData.YouTubeVideo.props.description
Name:

description

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

A summary or description of the video.

For more information, see the online documentation.

GData.YouTubeVideo.props.duration
Name:

duration

Type:

int

Default Value:

0

Flags:

READABLE

The duration of the video in seconds.

For more information, see the online documentation.

GData.YouTubeVideo.props.favorite_count
Name:

favorite-count

Type:

int

Default Value:

0

Flags:

READABLE

The number of users who have added the video to their favorites.

For more information, see the online documentation.

GData.YouTubeVideo.props.is_draft
Name:

is-draft

Type:

bool

Default Value:

False

Flags:

DEPRECATED, READABLE, WRITABLE

Indicates whether the video is in draft, or unpublished, status.

Deprecated since version 0.17.0: This is now equal to GData.YouTubeVideo :is-private.

GData.YouTubeVideo.props.is_private
Name:

is-private

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Indicates whether the video is private.

GData.YouTubeVideo.props.keywords
Name:

keywords

Type:

[str]

Default Value:

[]

Flags:

READABLE, WRITABLE

A None-terminated array of words associated with the video.

For more information, see the online documentation.

GData.YouTubeVideo.props.latitude
Name:

latitude

Type:

float

Default Value:

1.7976931348623157e+308

Flags:

READABLE, WRITABLE

The location as a latitude coordinate associated with this video. Valid latitudes range from -90.0 to 90.0 inclusive. Set to a value outside this range to unset the location.

For more information, see the

online documentation.

New in version 0.8.0.

GData.YouTubeVideo.props.location
Name:

location

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

Descriptive text about the location where the video was taken.

For more information, see the online documentation.

GData.YouTubeVideo.props.longitude
Name:

longitude

Type:

float

Default Value:

1.7976931348623157e+308

Flags:

READABLE, WRITABLE

The location as a longitude coordinate associated with this video. Valid longitudes range from -180.0 to 180.0 inclusive. Set to a value outside this range to unset the location.

For more information, see the

online documentation.

New in version 0.8.0.

GData.YouTubeVideo.props.max_rating
Name:

max-rating

Type:

int

Default Value:

5

Flags:

READABLE

The maximum allowed rating for the video.

For more information, see the online documentation.

GData.YouTubeVideo.props.min_rating
Name:

min-rating

Type:

int

Default Value:

1

Flags:

READABLE

The minimum allowed rating for the video.

For more information, see the online documentation.

GData.YouTubeVideo.props.player_uri
Name:

player-uri

Type:

str

Default Value:

None

Flags:

READABLE

A URI for a browser-based media player for the full-length video (i.e. the video’s page on YouTube).

GData.YouTubeVideo.props.rating_count
Name:

rating-count

Type:

int

Default Value:

0

Flags:

READABLE

The number of times the video has been rated.

For more information, see the online documentation.

GData.YouTubeVideo.props.recorded
Name:

recorded

Type:

int

Default Value:

-1

Flags:

READABLE, WRITABLE

Specifies the time the video was originally recorded.

For more information, see the online documentation.

New in version 0.3.0.

GData.YouTubeVideo.props.state
Name:

state

Type:

GData.YouTubeState

Default Value:

None

Flags:

READABLE

Information describing the state of the video. If this is non-None, the video is not playable. It points to a GData.YouTubeState.

For more information, see the online documentation.

GData.YouTubeVideo.props.uploaded
Name:

uploaded

Type:

int

Default Value:

-1

Flags:

READABLE

Specifies the time the video was originally uploaded to YouTube.

For more information, see the online documentation.

GData.YouTubeVideo.props.video_id
Name:

video-id

Type:

str

Default Value:

None

Flags:

DEPRECATED, READABLE

Specifies a unique ID which YouTube uses to identify the video. For example: qz8EfkS4KK0.

For more information, see the online documentation.

Deprecated since version 0.17.0: This is now equal to GData.Entry :id.

GData.YouTubeVideo.props.view_count
Name:

view-count

Type:

int

Default Value:

0

Flags:

READABLE

The number of times the video has been viewed.

For more information, see the online documentation.