Class: Yt::Models::Video
- Defined in:
- lib/yt/models/video.rb
Overview
Provides methods to interact with YouTube videos.
Instance Attribute Summary collapse
-
#actual_end_time ⇒ Time?
readonly
The time when a live broadcast ended.
-
#actual_start_time ⇒ Time?
readonly
The time when a live broadcast started.
-
#ad_formats ⇒ Array<String>
readonly
The list of ad formats that the video is allowed to show.
-
#annotations ⇒ Yt::Collections::Annotations
readonly
The video’s annotations.
-
#channel_id ⇒ String
readonly
The ID of the channel that the video belongs to.
-
#channel_title ⇒ String
readonly
The title of the channel that the video belongs to.
-
#comment_count ⇒ Integer
readonly
The number of comments for the video.
-
#concurrent_viewers ⇒ Integer?
readonly
The number of current viewers of a live broadcast.
-
#container ⇒ String
readonly
The video container of the uploaded file.
-
#description ⇒ String
readonly
The video’s description.
-
#dislike_count ⇒ Integer
readonly
The number of users who disliked the video.
-
#duration ⇒ Integer
readonly
The duration of the video (in seconds).
-
#embed_html ⇒ String
readonly
The HTML code of an <iframe> tag that embeds a player that will play the video.
-
#favorite_count ⇒ Integer
readonly
The number of users who marked the video as favorite.
-
#file_size ⇒ Integer
readonly
The size of the uploaded file (in bytes).
-
#file_type ⇒ String
readonly
The type of file uploaded.
-
#license ⇒ String
readonly
The video’s license.
-
#like_count ⇒ Integer
readonly
The number of users who liked the video.
-
#live_broadcast_content ⇒ String
readonly
The type of live broadcast that the video contains.
-
#published_at ⇒ Time
readonly
The date and time that the video was published.
-
#scheduled_end_time ⇒ Time?
readonly
The time when a live broadcast is scheduled to end.
-
#scheduled_start_time ⇒ Time?
readonly
The time when a live broadcast is scheduled to start.
-
#title ⇒ String
readonly
The video’s title.
-
#view_count ⇒ Integer
readonly
The number of times the video has been viewed.
Attributes inherited from Resource
Instance Method Summary collapse
-
#aborted? ⇒ Boolean
Whether the video failed to upload to YouTube because the uploading process was aborted.
-
#age_restricted? ⇒ Boolean
Whether the video is identified by YouTube as age-restricted content.
-
#annotation_click_through_rate(options = {}) ⇒ Hash<Date, Float>, ...
Returns the annotation_click_through_rate grouped by the given dimension.
-
#annotation_clicks(options = {}) ⇒ Hash<Date, Integer>, ...
Returns the annotation_clicks grouped by the given dimension.
-
#annotation_close_rate(options = {}) ⇒ Hash<Date, Float>, ...
Returns the annotation_close_rate grouped by the given dimension.
-
#average_view_duration(options = {}) ⇒ Hash<Date, Integer>, ...
Returns the average_view_duration grouped by the given dimension.
-
#average_view_percentage(options = {}) ⇒ Hash<Date, Float>, ...
Returns the average_view_percentage grouped by the given dimension.
-
#belongs_to_closed_account? ⇒ Boolean
Whether the video was rejected by YouTube because the account that uploaded the video has been closed.
-
#belongs_to_suspended_account? ⇒ Boolean
Whether the video was rejected by YouTube because the account that uploaded the video has been suspended.
-
#captioned? ⇒ Boolean
Whether captions are available for the video.
-
#category_id ⇒ String
ID of the YouTube category associated with the video.
-
#category_title ⇒ String
The video category’s title.
-
#claimed? ⇒ Boolean
Whether the video was rejected by YouTube because the video was claimed by a different account.
-
#comments(options = {}) ⇒ Hash<Date, Integer>, ...
Returns the comments grouped by the given dimension.
-
#delete(options = {}) ⇒ Boolean
Deletes the video on behalf of the authenticated account.
-
#deleted? ⇒ Boolean
Whether the video was deleted by the user.
-
#dislike ⇒ Boolean
Dislikes the video on behalf of the authenticated account.
-
#dislikes(options = {}) ⇒ Hash<Date, Integer>, ...
Returns the dislikes grouped by the given dimension.
-
#duplicate? ⇒ Boolean
Whether the video was rejected by YouTube because the video is a duplicate of another video.
-
#earnings(options = {}) ⇒ Hash<Date, Float>, ...
Returns the earnings grouped by the given dimension.
-
#embeddable? ⇒ Boolean
Whether the video can be embedded on other websites.
-
#empty? ⇒ Boolean
Whether the video failed to upload to YouTube because the video file is empty.
-
#estimated_minutes_watched(options = {}) ⇒ Hash<Symbol, Integer>, ...
Returns the estimated_minutes_watched grouped by the given dimension.
-
#failed? ⇒ Boolean
Whether the video failed to upload.
-
#favorites_added(options = {}) ⇒ Hash<Date, Integer>, ...
Returns the favorites_added grouped by the given dimension.
-
#favorites_removed(options = {}) ⇒ Hash<Date, Integer>, ...
Returns the favorites_removed grouped by the given dimension.
-
#has_failed_conversion? ⇒ Boolean
Whether the video failed to upload to YouTube because YouTube was unable to convert the video.
-
#has_public_stats_viewable? ⇒ Boolean
Returns whether the video statistics are publicly viewable.
-
#hd? ⇒ Boolean
Whether the video is available in high definition.
-
#impressions(options = {}) ⇒ Hash<Date, Integer>, ...
Returns the impressions grouped by the given dimension.
-
#inappropriate? ⇒ Boolean
Whether the video was rejected by YouTube because the video contains inappropriate content.
-
#infringes_copyright? ⇒ Boolean
Whether the video was rejected by YouTube because the video commits a copyright infringement.
-
#infringes_trademark? ⇒ Boolean
Whether the video was rejected by YouTube because the video infringes a trademark.
-
#invalid? ⇒ Boolean
Whether the video failed to upload to YouTube because the video uses an unsupported file format.
-
#licensed? ⇒ Boolean
Whether the video represents licensed content, which means that the content has been claimed by a YouTube content partner.
-
#licensed_as_creative_commons? ⇒ Boolean
Whether the video uses a Creative Commons license.
-
#licensed_as_standard_youtube? ⇒ Boolean
Whether the video uses the Standard YouTube license.
-
#like ⇒ Boolean
Likes the video on behalf of the authenticated account.
-
#liked? ⇒ Boolean
Whether the authenticated account likes the video.
-
#likes(options = {}) ⇒ Hash<Date, Integer>, ...
Returns the likes grouped by the given dimension.
-
#monetized_playbacks(options = {}) ⇒ Hash<Date, Integer>, ...
Returns the monetized_playbacks grouped by the given dimension.
-
#playback_based_cpm(options = {}) ⇒ Hash<Date, Float>, ...
Returns the playback_based_cpm grouped by the given dimension.
-
#processed? ⇒ Boolean
Whether the video has been fully processed by YouTube.
-
#rejected? ⇒ Boolean
Whether the video was rejected by YouTube.
-
#reports(options = {}) ⇒ Hash<Symbol, Hash>
Returns the reports for the given metrics grouped by the given dimension.
-
#scheduled? ⇒ Boolean
Whether the video is scheduled to be published.
-
#scheduled_at ⇒ Time?
Returns the time when a video is scheduled to be published.
-
#shares(options = {}) ⇒ Hash<Date, Integer>, ...
Returns the shares grouped by the given dimension.
-
#stereoscopic? ⇒ Boolean
Whether the video is available in 3D.
-
#subscribers_gained(options = {}) ⇒ Hash<Date, Integer>, ...
Returns the subscribers_gained grouped by the given dimension.
-
#subscribers_lost(options = {}) ⇒ Hash<Date, Integer>, ...
Returns the subscribers_lost grouped by the given dimension.
-
#tags ⇒ Array<String>
The list of tags attached to the video.
-
#thumbnail_url(size = :default) ⇒ String?
Returns the URL of the video’s thumbnail.
-
#too_long? ⇒ Boolean
Whether the video was rejected by YouTube because the video exceeds the maximum duration for YouTube.
-
#too_small? ⇒ Boolean
Whether the video failed to upload to YouTube because the video file is too small for YouTube.
-
#uniques(options = {}) ⇒ Hash<Date, Integer>, Hash<Range<Date, Date>, Integer>
Returns the uniques grouped by the given dimension.
-
#unlike ⇒ Boolean
Resets the rating of the video on behalf of the authenticated account.
-
#update(attributes = {}) ⇒ Boolean
Updates the attributes of a video.
-
#upload_thumbnail(path_or_url) ⇒ Object
Uploads a thumbnail.
-
#uploading? ⇒ Boolean
Whether the video is being uploaded to YouTube.
-
#uses_unsupported_codec? ⇒ Boolean
Whether the video failed to upload to YouTube because of an unsupported codec.
-
#videos_added_to_playlists(options = {}) ⇒ Hash<Date, Integer>, ...
Returns the videos_added_to_playlists grouped by the given dimension.
-
#videos_removed_from_playlists(options = {}) ⇒ Hash<Date, Integer>, ...
Returns the videos_removed_from_playlists grouped by the given dimension.
-
#viewer_percentage(options = {}) ⇒ Hash<Symbol, Float>, ...
Returns the viewer_percentage grouped by the given dimension.
-
#views(options = {}) ⇒ Hash<Symbol, Integer>, ...
Returns the views grouped by the given dimension.
-
#violates_terms_of_use? ⇒ Boolean
Whether the video was rejected by YouTube because the video violates the Terms of Use.
Methods inherited from Resource
#private?, #public?, #unlisted?
Instance Attribute Details
#actual_end_time ⇒ Time? (readonly)
The time when a live broadcast ended.
346 |
# File 'lib/yt/models/video.rb', line 346 delegate :actual_end_time, to: :live_streaming_detail |
#actual_start_time ⇒ Time? (readonly)
The time when a live broadcast started.
340 |
# File 'lib/yt/models/video.rb', line 340 delegate :actual_start_time, to: :live_streaming_detail |
#ad_formats ⇒ Array<String> (readonly)
Returns the list of ad formats that the video is allowed to show. Possible values are: ‘long’, ‘overlay’, ‘standard_instream’, ‘third_party’, ‘trueview_inslate’, ‘trueview_instream’.
330 |
# File 'lib/yt/models/video.rb', line 330 delegate :ad_formats, to: :advertising_options_set |
#annotations ⇒ Yt::Collections::Annotations (readonly)
Returns the video’s annotations.
375 |
# File 'lib/yt/models/video.rb', line 375 has_many :annotations |
#channel_id ⇒ String (readonly)
Returns the ID of the channel that the video belongs to.
34 |
# File 'lib/yt/models/video.rb', line 34 delegate :channel_id, to: :snippet |
#channel_title ⇒ String (readonly)
Returns the title of the channel that the video belongs to.
38 |
# File 'lib/yt/models/video.rb', line 38 delegate :channel_title, to: :snippet |
#comment_count ⇒ Integer (readonly)
Returns the number of comments for the video.
478 |
# File 'lib/yt/models/video.rb', line 478 delegate :comment_count, to: :statistics_set |
#concurrent_viewers ⇒ Integer? (readonly)
The number of current viewers of a live broadcast.
369 |
# File 'lib/yt/models/video.rb', line 369 delegate :concurrent_viewers, to: :live_streaming_detail |
#container ⇒ String (readonly)
Returns the video container of the uploaded file. (e.g. ‘mov’).
271 |
# File 'lib/yt/models/video.rb', line 271 delegate :container, to: :file_detail |
#description ⇒ String (readonly)
Returns the video’s description.
17 |
# File 'lib/yt/models/video.rb', line 17 delegate :description, to: :snippet |
#dislike_count ⇒ Integer (readonly)
Returns the number of users who disliked the video.
470 |
# File 'lib/yt/models/video.rb', line 470 delegate :dislike_count, to: :statistics_set |
#duration ⇒ Integer (readonly)
Returns the duration of the video (in seconds).
227 |
# File 'lib/yt/models/video.rb', line 227 delegate :duration, to: :content_detail |
#embed_html ⇒ String (readonly)
Returns the HTML code of an <iframe> tag that embeds a player that will play the video.
487 |
# File 'lib/yt/models/video.rb', line 487 delegate :embed_html, to: :player |
#favorite_count ⇒ Integer (readonly)
Returns the number of users who marked the video as favorite.
474 |
# File 'lib/yt/models/video.rb', line 474 delegate :favorite_count, to: :statistics_set |
#file_size ⇒ Integer (readonly)
Returns the size of the uploaded file (in bytes).
262 |
# File 'lib/yt/models/video.rb', line 262 delegate :file_size, to: :file_detail |
#file_type ⇒ String (readonly)
Returns the type of file uploaded. May be one of: archive, audio, document, image, other, project, video.
267 |
# File 'lib/yt/models/video.rb', line 267 delegate :file_type, to: :file_detail |
#license ⇒ String (readonly)
Returns the video’s license. Possible values are: ‘creativeCommon’, ‘youtube’.
192 |
# File 'lib/yt/models/video.rb', line 192 delegate :license, to: :status |
#like_count ⇒ Integer (readonly)
Returns the number of users who liked the video.
466 |
# File 'lib/yt/models/video.rb', line 466 delegate :like_count, to: :statistics_set |
#live_broadcast_content ⇒ String (readonly)
Returns the type of live broadcast that the video contains. Possible values are: ‘live’, ‘none’, ‘upcoming’.
43 |
# File 'lib/yt/models/video.rb', line 43 delegate :live_broadcast_content, to: :snippet |
#published_at ⇒ Time (readonly)
Returns the date and time that the video was published.
30 |
# File 'lib/yt/models/video.rb', line 30 delegate :published_at, to: :snippet |
#scheduled_end_time ⇒ Time? (readonly)
The time when a live broadcast is scheduled to end.
360 |
# File 'lib/yt/models/video.rb', line 360 delegate :scheduled_end_time, to: :live_streaming_detail |
#scheduled_start_time ⇒ Time? (readonly)
The time when a live broadcast is scheduled to start.
352 |
# File 'lib/yt/models/video.rb', line 352 delegate :scheduled_start_time, to: :live_streaming_detail |
#title ⇒ String (readonly)
Returns the video’s title.
13 |
# File 'lib/yt/models/video.rb', line 13 delegate :title, to: :snippet |
#view_count ⇒ Integer (readonly)
Returns the number of times the video has been viewed.
462 |
# File 'lib/yt/models/video.rb', line 462 delegate :view_count, to: :statistics_set |
Instance Method Details
#aborted? ⇒ Boolean
Returns whether the video failed to upload to YouTube because the uploading process was aborted.
116 117 118 |
# File 'lib/yt/models/video.rb', line 116 def aborted? status.failure_reason == 'uploadAborted' end |
#age_restricted? ⇒ Boolean
Returns whether the video is identified by YouTube as age-restricted content.
252 253 254 |
# File 'lib/yt/models/video.rb', line 252 def age_restricted? content_detail. == 'ytAgeRestricted' end |
#annotation_click_through_rate(options = {}) ⇒ Hash<Date, Float>, ...
Returns the annotation_click_through_rate grouped by the given dimension.
439 |
# File 'lib/yt/models/video.rb', line 439 has_report :annotation_click_through_rate, Float |
#annotation_clicks(options = {}) ⇒ Hash<Date, Integer>, ...
Returns the annotation_clicks grouped by the given dimension.
436 |
# File 'lib/yt/models/video.rb', line 436 has_report :annotation_clicks, Integer |
#annotation_close_rate(options = {}) ⇒ Hash<Date, Float>, ...
Returns the annotation_close_rate grouped by the given dimension.
442 |
# File 'lib/yt/models/video.rb', line 442 has_report :annotation_close_rate, Float |
#average_view_duration(options = {}) ⇒ Hash<Date, Integer>, ...
Returns the average_view_duration grouped by the given dimension.
430 |
# File 'lib/yt/models/video.rb', line 430 has_report :average_view_duration, Integer |
#average_view_percentage(options = {}) ⇒ Hash<Date, Float>, ...
Returns the average_view_percentage grouped by the given dimension.
433 |
# File 'lib/yt/models/video.rb', line 433 has_report :average_view_percentage, Float |
#belongs_to_closed_account? ⇒ Boolean
Returns whether the video was rejected by YouTube because the account that uploaded the video has been closed.
166 167 168 |
# File 'lib/yt/models/video.rb', line 166 def belongs_to_closed_account? status.rejection_reason == 'uploaderAccountClosed' end |
#belongs_to_suspended_account? ⇒ Boolean
Returns whether the video was rejected by YouTube because the account that uploaded the video has been suspended.
172 173 174 |
# File 'lib/yt/models/video.rb', line 172 def belongs_to_suspended_account? status.rejection_reason == 'uploaderAccountSuspended' end |
#captioned? ⇒ Boolean
Returns whether captions are available for the video.
240 241 242 |
# File 'lib/yt/models/video.rb', line 240 def content_detail. == 'true' end |
#category_id ⇒ String
Returns ID of the YouTube category associated with the video.
51 52 53 |
# File 'lib/yt/models/video.rb', line 51 def category_id ensure_complete_snippet :category_id end |
#category_title ⇒ String
Returns the video category’s title.
317 318 319 |
# File 'lib/yt/models/video.rb', line 317 def category_title video_category.title end |
#claimed? ⇒ Boolean
Returns whether the video was rejected by YouTube because the video was claimed by a different account.
122 123 124 |
# File 'lib/yt/models/video.rb', line 122 def claimed? status.rejection_reason == 'claim' end |
#comments(options = {}) ⇒ Hash<Date, Integer>, ...
Returns the comments grouped by the given dimension.
396 |
# File 'lib/yt/models/video.rb', line 396 has_report :comments, Integer |
#delete(options = {}) ⇒ Boolean
Deletes the video on behalf of the authenticated account.
510 511 512 513 |
# File 'lib/yt/models/video.rb', line 510 def delete( = {}) do_delete {@id = nil} !exists? end |
#deleted? ⇒ Boolean
Returns whether the video was deleted by the user.
58 59 60 |
# File 'lib/yt/models/video.rb', line 58 def deleted? status.upload_status == 'deleted' end |
#dislike ⇒ Boolean
Dislikes the video on behalf of the authenticated account.
298 299 300 301 |
# File 'lib/yt/models/video.rb', line 298 def dislike .set :dislike !liked? end |
#dislikes(options = {}) ⇒ Hash<Date, Integer>, ...
Returns the dislikes grouped by the given dimension.
402 |
# File 'lib/yt/models/video.rb', line 402 has_report :dislikes, Integer |
#duplicate? ⇒ Boolean
Returns whether the video was rejected by YouTube because the video is a duplicate of another video.
134 135 136 |
# File 'lib/yt/models/video.rb', line 134 def duplicate? status.rejection_reason == 'duplicate' end |
#earnings(options = {}) ⇒ Hash<Date, Float>, ...
Returns the earnings grouped by the given dimension.
445 |
# File 'lib/yt/models/video.rb', line 445 has_report :earnings, Float |
#embeddable? ⇒ Boolean
Returns whether the video can be embedded on other websites.
217 218 219 |
# File 'lib/yt/models/video.rb', line 217 def status. end |
#empty? ⇒ Boolean
Returns whether the video failed to upload to YouTube because the video file is empty.
97 98 99 |
# File 'lib/yt/models/video.rb', line 97 def empty? status.failure_reason == 'emptyFile' end |
#estimated_minutes_watched(options = {}) ⇒ Hash<Symbol, Integer>, ...
Returns the estimated_minutes_watched grouped by the given dimension.
390 |
# File 'lib/yt/models/video.rb', line 390 has_report :estimated_minutes_watched, Integer |
#failed? ⇒ Boolean
Returns whether the video failed to upload.
63 64 65 |
# File 'lib/yt/models/video.rb', line 63 def failed? status.upload_status == 'failed' end |
#favorites_added(options = {}) ⇒ Hash<Date, Integer>, ...
Returns the favorites_added grouped by the given dimension.
418 |
# File 'lib/yt/models/video.rb', line 418 has_report :favorites_added, Integer |
#favorites_removed(options = {}) ⇒ Hash<Date, Integer>, ...
Returns the favorites_removed grouped by the given dimension.
421 |
# File 'lib/yt/models/video.rb', line 421 has_report :favorites_removed, Integer |
#has_failed_conversion? ⇒ Boolean
Returns whether the video failed to upload to YouTube because YouTube was unable to convert the video.
91 92 93 |
# File 'lib/yt/models/video.rb', line 91 def has_failed_conversion? status.failure_reason == 'conversion' end |
#has_public_stats_viewable? ⇒ Boolean
Returns whether the video statistics are publicly viewable.
212 213 214 |
# File 'lib/yt/models/video.rb', line 212 def has_public_stats_viewable? status.public_stats_viewable end |
#hd? ⇒ Boolean
Returns whether the video is available in high definition.
235 236 237 |
# File 'lib/yt/models/video.rb', line 235 def hd? content_detail.definition == 'hd' end |
#impressions(options = {}) ⇒ Hash<Date, Integer>, ...
Returns the impressions grouped by the given dimension.
448 |
# File 'lib/yt/models/video.rb', line 448 has_report :impressions, Integer |
#inappropriate? ⇒ Boolean
Returns whether the video was rejected by YouTube because the video contains inappropriate content.
140 141 142 |
# File 'lib/yt/models/video.rb', line 140 def inappropriate? status.rejection_reason == 'inappropriate' end |
#infringes_copyright? ⇒ Boolean
Returns whether the video was rejected by YouTube because the video commits a copyright infringement.
128 129 130 |
# File 'lib/yt/models/video.rb', line 128 def infringes_copyright? status.rejection_reason == 'copyright' end |
#infringes_trademark? ⇒ Boolean
Returns whether the video was rejected by YouTube because the video infringes a trademark.
160 161 162 |
# File 'lib/yt/models/video.rb', line 160 def infringes_trademark? status.rejection_reason == 'trademark' end |
#invalid? ⇒ Boolean
Returns whether the video failed to upload to YouTube because the video uses an unsupported file format.
104 105 106 |
# File 'lib/yt/models/video.rb', line 104 def invalid? status.failure_reason == 'invalidFile' end |
#licensed? ⇒ Boolean
Returns whether the video represents licensed content, which means that the content has been claimed by a YouTube content partner.
246 247 248 |
# File 'lib/yt/models/video.rb', line 246 def licensed? content_detail.licensed_content || false end |
#licensed_as_creative_commons? ⇒ Boolean
Returns whether the video uses a Creative Commons license.
202 203 204 |
# File 'lib/yt/models/video.rb', line 202 def licensed_as_creative_commons? license == 'creativeCommon' end |
#licensed_as_standard_youtube? ⇒ Boolean
Returns whether the video uses the Standard YouTube license.
196 197 198 |
# File 'lib/yt/models/video.rb', line 196 def licensed_as_standard_youtube? license == 'youtube' end |
#like ⇒ Boolean
Likes the video on behalf of the authenticated account.
289 290 291 292 |
# File 'lib/yt/models/video.rb', line 289 def like .set :like liked? end |
#liked? ⇒ Boolean
Returns whether the authenticated account likes the video.
281 282 283 |
# File 'lib/yt/models/video.rb', line 281 def liked? . == :like end |
#likes(options = {}) ⇒ Hash<Date, Integer>, ...
Returns the likes grouped by the given dimension.
399 |
# File 'lib/yt/models/video.rb', line 399 has_report :likes, Integer |
#monetized_playbacks(options = {}) ⇒ Hash<Date, Integer>, ...
Returns the monetized_playbacks grouped by the given dimension.
451 |
# File 'lib/yt/models/video.rb', line 451 has_report :monetized_playbacks, Integer |
#playback_based_cpm(options = {}) ⇒ Hash<Date, Float>, ...
Returns the playback_based_cpm grouped by the given dimension.
454 |
# File 'lib/yt/models/video.rb', line 454 has_report :playback_based_cpm, Float |
#processed? ⇒ Boolean
Returns whether the video has been fully processed by YouTube.
68 69 70 |
# File 'lib/yt/models/video.rb', line 68 def processed? status.upload_status == 'processed' end |
#rejected? ⇒ Boolean
Returns whether the video was rejected by YouTube.
73 74 75 |
# File 'lib/yt/models/video.rb', line 73 def rejected? status.upload_status == 'rejected' end |
#reports(options = {}) ⇒ Hash<Symbol, Hash>
Returns the reports for the given metrics grouped by the given dimension.
|
# File 'lib/yt/models/video.rb', line 381
|
#scheduled? ⇒ Boolean
Returns whether the video is scheduled to be published.
185 186 187 |
# File 'lib/yt/models/video.rb', line 185 def scheduled? private? && status.publish_at end |
#scheduled_at ⇒ Time?
Returns the time when a video is scheduled to be published.
180 181 182 |
# File 'lib/yt/models/video.rb', line 180 def scheduled_at status.publish_at if scheduled? end |
#shares(options = {}) ⇒ Hash<Date, Integer>, ...
Returns the shares grouped by the given dimension.
405 |
# File 'lib/yt/models/video.rb', line 405 has_report :shares, Integer |
#stereoscopic? ⇒ Boolean
Returns whether the video is available in 3D.
230 231 232 |
# File 'lib/yt/models/video.rb', line 230 def stereoscopic? content_detail.dimension == '3d' end |
#subscribers_gained(options = {}) ⇒ Hash<Date, Integer>, ...
This is not the total number of subscribers gained by the video’s channel, but the subscribers gained from the video’s page.
Returns the subscribers_gained grouped by the given dimension.
410 |
# File 'lib/yt/models/video.rb', line 410 has_report :subscribers_gained, Integer |
#subscribers_lost(options = {}) ⇒ Hash<Date, Integer>, ...
This is not the total number of subscribers lost by the video’s channel, but the subscribers lost from the video’s page.
Returns the subscribers_lost grouped by the given dimension.
415 |
# File 'lib/yt/models/video.rb', line 415 has_report :subscribers_lost, Integer |
#tags ⇒ Array<String>
Returns the list of tags attached to the video.
46 47 48 |
# File 'lib/yt/models/video.rb', line 46 def ensure_complete_snippet :tags end |
#thumbnail_url(size = :default) ⇒ String?
Returns the URL of the video’s thumbnail.
26 |
# File 'lib/yt/models/video.rb', line 26 delegate :thumbnail_url, to: :snippet |
#too_long? ⇒ Boolean
Returns whether the video was rejected by YouTube because the video exceeds the maximum duration for YouTube.
147 148 149 |
# File 'lib/yt/models/video.rb', line 147 def too_long? status.rejection_reason == 'length' end |
#too_small? ⇒ Boolean
Returns whether the video failed to upload to YouTube because the video file is too small for YouTube.
110 111 112 |
# File 'lib/yt/models/video.rb', line 110 def too_small? status.failure_reason == 'tooSmall' end |
#uniques(options = {}) ⇒ Hash<Date, Integer>, Hash<Range<Date, Date>, Integer>
Returns the uniques grouped by the given dimension.
387 |
# File 'lib/yt/models/video.rb', line 387 has_report :uniques, Integer |
#unlike ⇒ Boolean
Resets the rating of the video on behalf of the authenticated account.
307 308 309 310 |
# File 'lib/yt/models/video.rb', line 307 def unlike .set :none !liked? end |
#update(attributes = {}) ⇒ Boolean
Updates the attributes of a video.
550 551 552 |
# File 'lib/yt/models/video.rb', line 550 def update(attributes = {}) super end |
#upload_thumbnail(path_or_url) ⇒ Object
Uploads a thumbnail
497 498 499 500 501 502 503 504 |
# File 'lib/yt/models/video.rb', line 497 def upload_thumbnail(path_or_url) file = open(path_or_url, 'rb') rescue StringIO.new session = resumable_sessions.insert file.size session.update(body: file) do |data| snippet.instance_variable_set :@thumbnails, data['items'].first end end |
#uploading? ⇒ Boolean
Returns whether the video is being uploaded to YouTube.
78 79 80 |
# File 'lib/yt/models/video.rb', line 78 def uploading? status.upload_status == 'uploaded' end |
#uses_unsupported_codec? ⇒ Boolean
Returns whether the video failed to upload to YouTube because of an unsupported codec.
85 86 87 |
# File 'lib/yt/models/video.rb', line 85 def uses_unsupported_codec? status.failure_reason == 'codec' end |
#videos_added_to_playlists(options = {}) ⇒ Hash<Date, Integer>, ...
Returns the videos_added_to_playlists grouped by the given dimension.
424 |
# File 'lib/yt/models/video.rb', line 424 has_report :videos_added_to_playlists, Integer |
#videos_removed_from_playlists(options = {}) ⇒ Hash<Date, Integer>, ...
Returns the videos_removed_from_playlists grouped by the given dimension.
427 |
# File 'lib/yt/models/video.rb', line 427 has_report :videos_removed_from_playlists, Integer |
#viewer_percentage(options = {}) ⇒ Hash<Symbol, Float>, ...
Returns the viewer_percentage grouped by the given dimension.
393 |
# File 'lib/yt/models/video.rb', line 393 has_report :viewer_percentage, Float |
#views(options = {}) ⇒ Hash<Symbol, Integer>, ...
Returns the views grouped by the given dimension.
384 |
# File 'lib/yt/models/video.rb', line 384 has_report :views, Integer |
#violates_terms_of_use? ⇒ Boolean
Returns whether the video was rejected by YouTube because the video violates the Terms of Use.
153 154 155 |
# File 'lib/yt/models/video.rb', line 153 def violates_terms_of_use? status.rejection_reason == 'termsOfUse' end |