class YouTubeG::Model::Video

Attributes

author[R]
YouTubeG::Model::Author

Information about the YouTube user who owns a piece of video content.

categories[R]
Array

A array of YouTubeG::Model::Category objects that describe the videos categories.

description[R]
String

Description of the video.

duration[R]
Fixnum

Duration of a video in seconds.

html_content[R]
String

Description of the video.

keywords[R]
Array

An array of words associated with the video.

latitude[R]
longitude[R]
media_content[R]
Array

An array of YouTubeG::Model::Content objects describing the individual media content data available for this video. Most, but not all, videos offer this.

noembed[R]
Boolean

Specifies that a video may or may not be embedded on other websites.

player_url[R]
String

The link to watch the URL on YouTubes website.

position[R]
Fixnum

Specifies the order in which the video appears in a playlist.

published_at[R]
Time

When the video was published on Youtube.

racy[R]
Boolean

Specifies that a video is flagged as adult or not.

rating[R]
YouTubeG::Model::Rating

Information about the videos rating.

statistics[R]
thumbnails[R]
Array

An array of YouTubeG::Model::Thumbnail objects that contain information regarding the videos thumbnail images.

title[R]
String

Title for the video.

updated_at[R]
Time

When the video’s data was last updated.

video_id[R]

String: Specifies a URI that uniquely and permanently identifies the video.

view_count[R]
Fixnum

Number of times that the video has been viewed

where[R]

Geodata

Public Instance Methods

default_media_content() click to toggle source

Provides a URL and various other types of information about a video.

Returns

YouTubeG::Model::Content: Data about the embeddable video.
# File lib/youtube_g/model/video.rb, line 161
def default_media_content
  @media_content.find { |c| c.is_default? }
end
embed_html(width = 425, height = 350) click to toggle source

Gives you the HTML to embed the video on your website.

Returns

String: The HTML for embedding the video on your website.
# File lib/youtube_g/model/video.rb, line 169
      def embed_html(width = 425, height = 350)
        <<EDOC
<object width="#{width}" height="#{height}">
  <param name="movie" value="#{embed_url}"></param>
  <param name="wmode" value="transparent"></param>
  <embed src="#{embed_url}" type="application/x-shockwave-flash" 
   wmode="transparent" width="#{width}" height="#{height}"></embed>
</object>
EDOC
      end
embed_url() click to toggle source

The URL needed for embedding the video in a page.

Returns

String: Absolute URL for embedding video
# File lib/youtube_g/model/video.rb, line 184
def embed_url
  @player_url.sub('watch?', '').sub('=', '/')          
end
embeddable?() click to toggle source

Allows you to check whether the video can be embedded on a webpage.

Returns

Boolean: True if the video can be embedded, false if not.
# File lib/youtube_g/model/video.rb, line 153
def embeddable?
  not @noembed
end
responses() click to toggle source

Video responses to the current video.

Returns

YouTubeG::Response::VideoSearch
# File lib/youtube_g/model/video.rb, line 132
def responses
  YouTubeG::Parser::VideosFeedParser.new("http://gdata.youtube.com/feeds/api/videos/#{unique_id}/responses").parse
end
unique_id() click to toggle source

The ID of the video, useful for searching for the video again without having to store it anywhere. A regular query search, with this id will return the same video.

Example

>> video.unique_id
=> "ZTUVgYoeN_o"

Returns

String: The Youtube video id.
# File lib/youtube_g/model/video.rb, line 145
def unique_id
  video_id[/videos\/([^<]+)/, 1]
end