Class: Yt::Models::Video
- Defined in:
- lib/yt/models/video.rb
Overview
Provides methods to interact with YouTube videos.
Constant Summary
Constants inherited from Resource
Resource::CHANNEL_PATTERNS, Resource::PLAYLIST_PATTERNS, Resource::VIDEO_PATTERNS
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.
- #claim ⇒ Object readonly
-
#comment_count ⇒ Integer
readonly
The number of comments for the video.
-
#comments(options = {}) ⇒ Hash<Date, Integer>, ...
readonly
Returns the comments grouped by the given dimension.
-
#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 ⇒ String
readonly
The length of the video as an ISO 8601 time, HH:MM:SS.
-
#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_name ⇒ String
readonly
The name of the uploaded file.
-
#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.
-
#ad_impressions(options = {}) ⇒ Hash<Date, Integer>, ...
Returns the ad_impressions grouped by the given dimension.
-
#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.
-
#card_click_rate(options = {}) ⇒ Hash<Date, Float>, ...
Returns the card_click_rate grouped by the given dimension.
-
#card_clicks(options = {}) ⇒ Hash<Date, Integer>, ...
Returns the card_clicks grouped by the given dimension.
-
#card_impressions(options = {}) ⇒ Hash<Date, Integer>, ...
Returns the card_impressions grouped by the given dimension.
-
#card_teaser_click_rate(options = {}) ⇒ Hash<Date, Float>, ...
Returns the card_teaser_click_rate grouped by the given dimension.
-
#card_teaser_clicks(options = {}) ⇒ Hash<Date, Integer>, ...
Returns the card_teaser_clicks grouped by the given dimension.
-
#card_teaser_impressions(options = {}) ⇒ Hash<Date, Integer>, ...
Returns the card_teaser_impressions grouped by the given dimension.
-
#category_id ⇒ String
ID of the YouTube category associated with the video.
-
#category_title ⇒ String
The video category’s title.
-
#channel_url ⇒ <String>
The URL of the channel that the video belongs to.
-
#claimed? ⇒ Boolean
Whether the video was rejected by YouTube because the video was claimed by a different account.
-
#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.
-
#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.
-
#engaged_views(options = {}) ⇒ Hash<Symbol, Integer>, ...
Returns the engaged_views grouped by the given dimension.
-
#estimated_minutes_watched(options = {}) ⇒ Hash<Symbol, Integer>, ...
Returns the estimated_minutes_watched grouped by the given dimension.
-
#estimated_revenue(options = {}) ⇒ Hash<Date, Float>, ...
Returns the estimated_revenue grouped by the given dimension.
-
#failed? ⇒ Boolean
Whether the video failed to upload.
-
#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.
-
#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.
-
#made_for_kids? ⇒ Boolean
@return [Boolean, nil] This value indicates whether the video is designated as child-directed, and it contains the current “made for kids” status of the video.
-
#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.
-
#self_declared_made_for_kids? ⇒ Boolean
@return [Boolean, nil] In a videos.insert or videos.update request, this property allows the channel owner to designate the video as being child-directed.
-
#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.
-
#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.
375 |
# File 'lib/yt/models/video.rb', line 375 delegate :actual_end_time, to: :live_streaming_detail |
#actual_start_time ⇒ Time? (readonly)
The time when a live broadcast started.
369 |
# File 'lib/yt/models/video.rb', line 369 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’.
359 |
# File 'lib/yt/models/video.rb', line 359 delegate :ad_formats, to: :advertising_options_set |
#annotations ⇒ Yt::Collections::Annotations (readonly)
Returns the video’s annotations.
407 |
# File 'lib/yt/models/video.rb', line 407 has_many :annotations |
#channel_id ⇒ String (readonly)
Returns the ID of the channel that the video belongs to.
35 |
# File 'lib/yt/models/video.rb', line 35 delegate :channel_id, to: :snippet |
#channel_title ⇒ String (readonly)
Returns the title of the channel that the video belongs to.
39 |
# File 'lib/yt/models/video.rb', line 39 delegate :channel_title, to: :snippet |
#claim ⇒ Object (readonly)
414 415 416 |
# File 'lib/yt/models/video.rb', line 414 def claim @claim end |
#comment_count ⇒ Integer (readonly)
Returns the number of comments for the video.
529 |
# File 'lib/yt/models/video.rb', line 529 delegate :comment_count, to: :statistics_set |
#comments(options = {}) ⇒ Hash<Date, Integer>, ... (readonly)
Returns the comments grouped by the given dimension.
403 |
# File 'lib/yt/models/video.rb', line 403 has_many :comment_threads |
#concurrent_viewers ⇒ Integer? (readonly)
The number of current viewers of a live broadcast.
398 |
# File 'lib/yt/models/video.rb', line 398 delegate :concurrent_viewers, to: :live_streaming_detail |
#container ⇒ String (readonly)
Returns the video container of the uploaded file. (e.g. ‘mov’).
300 |
# File 'lib/yt/models/video.rb', line 300 delegate :container, to: :file_detail |
#description ⇒ String (readonly)
Returns the video’s description.
18 |
# File 'lib/yt/models/video.rb', line 18 delegate :description, to: :snippet |
#dislike_count ⇒ Integer (readonly)
Returns the number of users who disliked the video.
521 |
# File 'lib/yt/models/video.rb', line 521 delegate :dislike_count, to: :statistics_set |
#duration ⇒ String (readonly)
Returns the length of the video as an ISO 8601 time, HH:MM:SS.
248 |
# File 'lib/yt/models/video.rb', line 248 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.
538 |
# File 'lib/yt/models/video.rb', line 538 delegate :embed_html, to: :player |
#favorite_count ⇒ Integer (readonly)
Returns the number of users who marked the video as favorite.
525 |
# File 'lib/yt/models/video.rb', line 525 delegate :favorite_count, to: :statistics_set |
#file_name ⇒ String (readonly)
Returns the name of the uploaded file.
287 |
# File 'lib/yt/models/video.rb', line 287 delegate :file_name, to: :file_detail |
#file_size ⇒ Integer (readonly)
Returns the size of the uploaded file (in bytes).
291 |
# File 'lib/yt/models/video.rb', line 291 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.
296 |
# File 'lib/yt/models/video.rb', line 296 delegate :file_type, to: :file_detail |
#license ⇒ String (readonly)
Returns the video’s license. Possible values are: ‘creativeCommon’, ‘youtube’.
198 |
# File 'lib/yt/models/video.rb', line 198 delegate :license, to: :status |
#like_count ⇒ Integer (readonly)
Returns the number of users who liked the video.
517 |
# File 'lib/yt/models/video.rb', line 517 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’.
49 |
# File 'lib/yt/models/video.rb', line 49 delegate :live_broadcast_content, to: :snippet |
#published_at ⇒ Time (readonly)
Returns the date and time that the video was published.
31 |
# File 'lib/yt/models/video.rb', line 31 delegate :published_at, to: :snippet |
#scheduled_end_time ⇒ Time? (readonly)
The time when a live broadcast is scheduled to end.
389 |
# File 'lib/yt/models/video.rb', line 389 delegate :scheduled_end_time, to: :live_streaming_detail |
#scheduled_start_time ⇒ Time? (readonly)
The time when a live broadcast is scheduled to start.
381 |
# File 'lib/yt/models/video.rb', line 381 delegate :scheduled_start_time, to: :live_streaming_detail |
#title ⇒ String (readonly)
Returns the video’s title.
14 |
# File 'lib/yt/models/video.rb', line 14 delegate :title, to: :snippet |
#view_count ⇒ Integer (readonly)
Returns the number of times the video has been viewed.
513 |
# File 'lib/yt/models/video.rb', line 513 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.
122 123 124 |
# File 'lib/yt/models/video.rb', line 122 def aborted? status.failure_reason == 'uploadAborted' end |
#ad_impressions(options = {}) ⇒ Hash<Date, Integer>, ...
Returns the ad_impressions grouped by the given dimension.
499 |
# File 'lib/yt/models/video.rb', line 499 has_report :ad_impressions, Integer |
#age_restricted? ⇒ Boolean
Returns whether the video is identified by YouTube as age-restricted content.
277 278 279 |
# File 'lib/yt/models/video.rb', line 277 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.
472 |
# File 'lib/yt/models/video.rb', line 472 has_report :annotation_click_through_rate, Float |
#annotation_clicks(options = {}) ⇒ Hash<Date, Integer>, ...
Returns the annotation_clicks grouped by the given dimension.
469 |
# File 'lib/yt/models/video.rb', line 469 has_report :annotation_clicks, Integer |
#annotation_close_rate(options = {}) ⇒ Hash<Date, Float>, ...
Returns the annotation_close_rate grouped by the given dimension.
475 |
# File 'lib/yt/models/video.rb', line 475 has_report :annotation_close_rate, Float |
#average_view_duration(options = {}) ⇒ Hash<Date, Integer>, ...
Returns the average_view_duration grouped by the given dimension.
463 |
# File 'lib/yt/models/video.rb', line 463 has_report :average_view_duration, Integer |
#average_view_percentage(options = {}) ⇒ Hash<Date, Float>, ...
Returns the average_view_percentage grouped by the given dimension.
466 |
# File 'lib/yt/models/video.rb', line 466 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.
172 173 174 |
# File 'lib/yt/models/video.rb', line 172 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.
178 179 180 |
# File 'lib/yt/models/video.rb', line 178 def belongs_to_suspended_account? status.rejection_reason == 'uploaderAccountSuspended' end |
#captioned? ⇒ Boolean
Returns whether captions are available for the video.
265 266 267 |
# File 'lib/yt/models/video.rb', line 265 def captioned? content_detail.caption == 'true' end |
#card_click_rate(options = {}) ⇒ Hash<Date, Float>, ...
Returns the card_click_rate grouped by the given dimension.
484 |
# File 'lib/yt/models/video.rb', line 484 has_report :card_click_rate, Float |
#card_clicks(options = {}) ⇒ Hash<Date, Integer>, ...
Returns the card_clicks grouped by the given dimension.
481 |
# File 'lib/yt/models/video.rb', line 481 has_report :card_clicks, Integer |
#card_impressions(options = {}) ⇒ Hash<Date, Integer>, ...
Returns the card_impressions grouped by the given dimension.
478 |
# File 'lib/yt/models/video.rb', line 478 has_report :card_impressions, Integer |
#card_teaser_click_rate(options = {}) ⇒ Hash<Date, Float>, ...
Returns the card_teaser_click_rate grouped by the given dimension.
493 |
# File 'lib/yt/models/video.rb', line 493 has_report :card_teaser_click_rate, Float |
#card_teaser_clicks(options = {}) ⇒ Hash<Date, Integer>, ...
Returns the card_teaser_clicks grouped by the given dimension.
490 |
# File 'lib/yt/models/video.rb', line 490 has_report :card_teaser_clicks, Integer |
#card_teaser_impressions(options = {}) ⇒ Hash<Date, Integer>, ...
Returns the card_teaser_impressions grouped by the given dimension.
487 |
# File 'lib/yt/models/video.rb', line 487 has_report :card_teaser_impressions, Integer |
#category_id ⇒ String
Returns ID of the YouTube category associated with the video.
57 58 59 |
# File 'lib/yt/models/video.rb', line 57 def category_id ensure_complete_snippet :category_id end |
#category_title ⇒ String
Returns the video category’s title.
346 347 348 |
# File 'lib/yt/models/video.rb', line 346 def category_title video_category.title end |
#channel_url ⇒ <String>
Returns the URL of the channel that the video belongs to.
42 43 44 |
# File 'lib/yt/models/video.rb', line 42 def channel_url "https://www.youtube.com/channel/#{channel_id}" end |
#claimed? ⇒ Boolean
Returns whether the video was rejected by YouTube because the video was claimed by a different account.
128 129 130 |
# File 'lib/yt/models/video.rb', line 128 def claimed? status.rejection_reason == 'claim' end |
#delete(options = {}) ⇒ Boolean
Deletes the video on behalf of the authenticated account.
565 566 567 568 |
# File 'lib/yt/models/video.rb', line 565 def delete( = {}) do_delete {@id = nil} !exists? end |
#deleted? ⇒ Boolean
Returns whether the video was deleted by the user.
64 65 66 |
# File 'lib/yt/models/video.rb', line 64 def deleted? status.upload_status == 'deleted' end |
#dislike ⇒ Boolean
Dislikes the video on behalf of the authenticated account.
327 328 329 330 |
# File 'lib/yt/models/video.rb', line 327 def dislike .set :dislike !liked? end |
#dislikes(options = {}) ⇒ Hash<Date, Integer>, ...
Returns the dislikes grouped by the given dimension.
441 |
# File 'lib/yt/models/video.rb', line 441 has_report :dislikes, Integer |
#duplicate? ⇒ Boolean
Returns whether the video was rejected by YouTube because the video is a duplicate of another video.
140 141 142 |
# File 'lib/yt/models/video.rb', line 140 def duplicate? status.rejection_reason == 'duplicate' end |
#embeddable? ⇒ Boolean
Returns whether the video can be embedded on other websites.
223 224 225 |
# File 'lib/yt/models/video.rb', line 223 def status. end |
#empty? ⇒ Boolean
Returns whether the video failed to upload to YouTube because the video file is empty.
103 104 105 |
# File 'lib/yt/models/video.rb', line 103 def empty? status.failure_reason == 'emptyFile' end |
#engaged_views(options = {}) ⇒ Hash<Symbol, Integer>, ...
Returns the engaged_views grouped by the given dimension.
426 |
# File 'lib/yt/models/video.rb', line 426 has_report :engaged_views, Integer |
#estimated_minutes_watched(options = {}) ⇒ Hash<Symbol, Integer>, ...
Returns the estimated_minutes_watched grouped by the given dimension.
429 |
# File 'lib/yt/models/video.rb', line 429 has_report :estimated_minutes_watched, Integer |
#estimated_revenue(options = {}) ⇒ Hash<Date, Float>, ...
Returns the estimated_revenue grouped by the given dimension.
496 |
# File 'lib/yt/models/video.rb', line 496 has_report :estimated_revenue, Float |
#failed? ⇒ Boolean
Returns whether the video failed to upload.
69 70 71 |
# File 'lib/yt/models/video.rb', line 69 def failed? status.upload_status == 'failed' end |
#has_failed_conversion? ⇒ Boolean
Returns whether the video failed to upload to YouTube because YouTube was unable to convert the video.
97 98 99 |
# File 'lib/yt/models/video.rb', line 97 def has_failed_conversion? status.failure_reason == 'conversion' end |
#has_public_stats_viewable? ⇒ Boolean
Returns whether the video statistics are publicly viewable.
218 219 220 |
# File 'lib/yt/models/video.rb', line 218 def has_public_stats_viewable? status.public_stats_viewable end |
#hd? ⇒ Boolean
Returns whether the video is available in high definition.
260 261 262 |
# File 'lib/yt/models/video.rb', line 260 def hd? content_detail.definition == 'hd' end |
#inappropriate? ⇒ Boolean
Returns whether the video was rejected by YouTube because the video contains inappropriate content.
146 147 148 |
# File 'lib/yt/models/video.rb', line 146 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.
134 135 136 |
# File 'lib/yt/models/video.rb', line 134 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.
166 167 168 |
# File 'lib/yt/models/video.rb', line 166 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.
110 111 112 |
# File 'lib/yt/models/video.rb', line 110 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.
271 272 273 |
# File 'lib/yt/models/video.rb', line 271 def licensed? content_detail.licensed_content || false end |
#licensed_as_creative_commons? ⇒ Boolean
Returns whether the video uses a Creative Commons license.
208 209 210 |
# File 'lib/yt/models/video.rb', line 208 def licensed_as_creative_commons? license == 'creativeCommon' end |
#licensed_as_standard_youtube? ⇒ Boolean
Returns whether the video uses the Standard YouTube license.
202 203 204 |
# File 'lib/yt/models/video.rb', line 202 def licensed_as_standard_youtube? license == 'youtube' end |
#like ⇒ Boolean
Likes the video on behalf of the authenticated account.
318 319 320 321 |
# File 'lib/yt/models/video.rb', line 318 def like .set :like liked? end |
#liked? ⇒ Boolean
Returns whether the authenticated account likes the video.
310 311 312 |
# File 'lib/yt/models/video.rb', line 310 def liked? . == :like end |
#likes(options = {}) ⇒ Hash<Date, Integer>, ...
Returns the likes grouped by the given dimension.
438 |
# File 'lib/yt/models/video.rb', line 438 has_report :likes, Integer |
#made_for_kids? ⇒ Boolean
@return [Boolean, nil] This value indicates whether the video is
designated as child-directed, and it contains the current "made for
kids" status of the video.
230 231 232 |
# File 'lib/yt/models/video.rb', line 230 def made_for_kids? status.made_for_kids end |
#monetized_playbacks(options = {}) ⇒ Hash<Date, Integer>, ...
Returns the monetized_playbacks grouped by the given dimension.
502 |
# File 'lib/yt/models/video.rb', line 502 has_report :monetized_playbacks, Integer |
#playback_based_cpm(options = {}) ⇒ Hash<Date, Float>, ...
Returns the playback_based_cpm grouped by the given dimension.
505 |
# File 'lib/yt/models/video.rb', line 505 has_report :playback_based_cpm, Float |
#processed? ⇒ Boolean
Returns whether the video has been fully processed by YouTube.
74 75 76 |
# File 'lib/yt/models/video.rb', line 74 def processed? status.upload_status == 'processed' end |
#rejected? ⇒ Boolean
Returns whether the video was rejected by YouTube.
79 80 81 |
# File 'lib/yt/models/video.rb', line 79 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 420
|
#scheduled? ⇒ Boolean
Returns whether the video is scheduled to be published.
191 192 193 |
# File 'lib/yt/models/video.rb', line 191 def scheduled? private? && status.publish_at end |
#scheduled_at ⇒ Time?
Returns the time when a video is scheduled to be published.
186 187 188 |
# File 'lib/yt/models/video.rb', line 186 def scheduled_at status.publish_at if scheduled? end |
#self_declared_made_for_kids? ⇒ Boolean
@return [Boolean, nil] In a videos.insert or videos.update request,
this property allows the channel owner to designate the video as
being child-directed. In a videos.list request, the property value
is only returned if the channel owner authorized the API request.
238 239 240 |
# File 'lib/yt/models/video.rb', line 238 def self_declared_made_for_kids? status.self_declared_made_for_kids end |
#shares(options = {}) ⇒ Hash<Date, Integer>, ...
Returns the shares grouped by the given dimension.
444 |
# File 'lib/yt/models/video.rb', line 444 has_report :shares, Integer |
#stereoscopic? ⇒ Boolean
Returns whether the video is available in 3D.
255 256 257 |
# File 'lib/yt/models/video.rb', line 255 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.
449 |
# File 'lib/yt/models/video.rb', line 449 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.
454 |
# File 'lib/yt/models/video.rb', line 454 has_report :subscribers_lost, Integer |
#tags ⇒ Array<String>
Returns the list of tags attached to the video.
52 53 54 |
# File 'lib/yt/models/video.rb', line 52 def ensure_complete_snippet :tags end |
#thumbnail_url(size = :default) ⇒ String?
Returns the URL of the video’s thumbnail.
27 |
# File 'lib/yt/models/video.rb', line 27 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.
153 154 155 |
# File 'lib/yt/models/video.rb', line 153 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.
116 117 118 |
# File 'lib/yt/models/video.rb', line 116 def too_small? status.failure_reason == 'tooSmall' end |
#unlike ⇒ Boolean
Resets the rating of the video on behalf of the authenticated account.
336 337 338 339 |
# File 'lib/yt/models/video.rb', line 336 def unlike .set :none !liked? end |
#update(attributes = {}) ⇒ Boolean
Updates the attributes of a video.
605 606 607 |
# File 'lib/yt/models/video.rb', line 605 def update(attributes = {}) super end |
#upload_thumbnail(path_or_url) ⇒ Object
Uploads a thumbnail
552 553 554 555 556 557 558 559 |
# File 'lib/yt/models/video.rb', line 552 def upload_thumbnail(path_or_url) file = URI.open(path_or_url) 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.
84 85 86 |
# File 'lib/yt/models/video.rb', line 84 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.
91 92 93 |
# File 'lib/yt/models/video.rb', line 91 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.
457 |
# File 'lib/yt/models/video.rb', line 457 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.
460 |
# File 'lib/yt/models/video.rb', line 460 has_report :videos_removed_from_playlists, Integer |
#viewer_percentage(options = {}) ⇒ Hash<Symbol, Float>, ...
Returns the viewer_percentage grouped by the given dimension.
432 |
# File 'lib/yt/models/video.rb', line 432 has_report :viewer_percentage, Float |
#views(options = {}) ⇒ Hash<Symbol, Integer>, ...
Returns the views grouped by the given dimension.
423 |
# File 'lib/yt/models/video.rb', line 423 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.
159 160 161 |
# File 'lib/yt/models/video.rb', line 159 def violates_terms_of_use? status.rejection_reason == 'termsOfUse' end |