All notable changes to this project will be documented in this file.
For more information about changelogs, check Keep a Changelog and Vandamme.
- [REMOVAL] remove retry for quota errors
- [BUGFIX] require the
URLmodel when requiringyt - [BUGFIX] handle passing in a
nilid
- [BUGFIX] No more pages when page token is an empty string, per YouTube change.
- [BUGFIX] Only retry once when exchanging a refresh token
If your code calls reports methods such as views, likes, or reports,
do not include by: :week option since 7DayTotals dimension will no longer be
supported by YouTube API as of April 15, 2020.
Use by: :day option instead and add up the numbers from each day.
If you keep using by: :week option after this change it will raise an error
(before the gem upgrade) or it will run with day dimension instead (after
the gem upgrade, like any other random input).
- [REMOVAL] Remove
by: :weekoption for reports. - [FEATURE] Add back the option of initializing a resource by its URL.
- [BUGFIX] Limit retries on refreshing tokens
Breaking change
If your code is using constant Yt::URL::CHANNEL_PATTERNS etc then it's moved to Yt::Resource::CHANNEL_PATTERNS, Yt::Resource::VIDEO_PATTERNS, and Yt::Resource::PLAYLIST_PATTERNS.
- [FEATURE] Allow partnered channels to delete playlist item.
- [FEATURE] Allow partnered channels to update video.
- [FEATURE] Allow partnered channels to update playlist.
- [FEATURE] Allow partnered channels to upload thumbnail.
- [FEATURE] Allow partnered channels to create playlist item.
- [BUGFIX] Fix
MatchPolicy#updateandAsset#updateby usingPUTinstead ofPATCH - Update
bin/ytfile to keepyt infocommand work
- [FEATURE] Add
ownership_effectivemethod to access asset ownership ("effective") via the asset object. - [FEATURE] List content owners of others with
content_owner.content_owners - [FEATURE] Add
match_infoto insert claim request. - [FEATURE] Add
upload_reference_filemethod for Reference file upload (thank you @jcohenho) - [FEATURE] Get one asset by request (thank you @jcohenho)
- [FEATURE] Add
updatemethod to Yt::Claim (thank you @jcohenho)
- [ENHANCEMENT] Add
Yt::URLto get id, kind, and its resource (channel, video, playlist) - [BUGFIX] Fix
subscription.insertby adding a parameter - [FEATURE] Add
file_nameattribute toYt::FileDetailmodel
- Use YouTube Analytics API v2 instead of v1. See announcement of v1 deprecation https://developers.google.com/youtube/analytics/revision_history#april-26-2018
- [FEATURE] Add
Yt::ContentOwner#bulk_report_jobs - [FEATURE] Add
Yt::BulkReportJob#bulk_reports
How to upgrade
If your code is expecting data from reports methods to always include historical data (the data from the period before joining), now you have to set historical: true specifically. It will not include historical data by default.
- [IMPROVEMENT] Include historical data with
historical: trueoption.
- [BUGFIX] Return lifetime data correctly even when the channel joined content owner after a while since it's created.
- [FEATURE] Add
by: :youtube_productoption for reports. - [FEATURE] Add
Yt::Collections::Reports::YOUTUBE_PRODUCTSto list all YouTube products (KIDS, GAMING, etc) supported by YouTube Analytics API. - [FEATURE] Add more operating system dimensions to
Yt::Collections::Reports::OPERATING_SYSTEMS.
How to upgrade
If your code calls .uniques it should be removed because this metric has been
no longer supported by YouTube API as of October 31, 2016.
- [REMOVAL] Remove
#uniquesmethod for channels, videos and video groups.
- [IMPROVEMENT] Retry 3 times if YouTube responds with 503 Backend Error
How to upgrade
If your code uses Yt::Models::Configuration then you must use
Yt::Configuration instead.
Both Yt::Configuration and Yt::Config have been moved in a separate
gem called yt-support that is required by default by the yt gem.
- [REMOVAL] Remove
Yt::Models::Configuration(renamed asYt::Configuration)
- [FEATURE] Add
Video#lengthto show the duration as an ISO 8601 time.
How to upgrade
If your code uses Yt::URL then you must include the yt-url gem, since
Yt::URL has been extracted into a separate repository.
Please read the documentation of Yt::URL and notice that the subscription
pattern has been dropped, so URLs such as the following will not be recognized
anymore: subscription_center?add_user=..., subscribe_widget?p=....
Note that this also removes the option of initializing a resource by URL.
You can achieve the same result with the yt-url gem, as detailed in its
documentation.
Finally note that this also remove the class Yt::Description. This class
was private API, so this change should not affect developers.
- [REMOVAL] Remove the option to initialize resources by URL.
- [REMOVAL] Remove
Yt::Resource.username - [REMOVAL] Remove
Yt::URL(extracted into separate gem) - [REMOVAL] Remove
Yt::Description(now simply a String).
- [BUGFIX] Don't crash when Yt::VideoGroup is initialized with a group of playlists.
- [BUGFIX] Don't crash when Yt::VideoGroup is initialized with a group of playlists.
- [FEATURE] Add
VideoGroup#channelsmethod to load all channels under a group.
- [FEATURE] Add
channel_urlto video.
- [FEATURE] New
card impressionsreport for video groups. - [FEATURE] New
card clicksreport for video groups. - [FEATURE] New
card click ratereport for video groups. - [FEATURE] New
card teaser impressionsreport for video groups. - [FEATURE] New
card teaser clicksreport for video groups. - [FEATURE] New
card teaser click ratereport for video groups.
How to upgrade
If your code calls .earnings and .impressions
then you must replace that code with .estimated_revenue and
.ad_impressions since those metrics will no longer be supported by
YouTube API as of November 4, 2016.
- [REMOVAL] Remove
#earningsmethod for channels, playlists, videos and video groups - [REMOVAL] Remove
#impressionsmethod for channels, videos and video groups - [FEATURE] Add
#estimated_revenuemethod for channels, videos and video groups - [FEATURE] Add
#ad_impressionsmethod for channels, videos and video groups
How to upgrade
If your code calls any of the following ..._on method to fetch metrics on
a specific day, you need to replace it with the equivalent method that does
not end with _on. For instance replace views_on(3.days.ago) with the
equivalent views(since: 3.days.ago, until: 3.days.ago).
- [REMOVAL] Remove
#views_onmethod for channels, playlists, videos and video groups - [REMOVAL] Remove
#uniques_onmethod for channels, playlists, videos and video groups - [REMOVAL] Remove
#estimated_minutes_watched_onmethod for channels, playlists, videos and video groups - [REMOVAL] Remove
#viewer_percentage_onmethod for channels, playlists, videos and video groups - [REMOVAL] Remove
#comments_onmethod for channels, playlists, videos and video groups - [REMOVAL] Remove
#likes_onmethod for channels, playlists, videos and video groups - [REMOVAL] Remove
#dislikes_onmethod for channels, playlists, videos and video groups - [REMOVAL] Remove
#shares_onmethod for channels, playlists, videos and video groups - [REMOVAL] Remove
#subscribers_gained_onmethod for channels, playlists, videos and video groups - [REMOVAL] Remove
#subscribers_lost_onmethod for channels, playlists, videos and video groups - [REMOVAL] Remove
#videos_added_to_playlists_onmethod for channels, playlists, videos and video groups - [REMOVAL] Remove
#videos_removed_from_playlists_onmethod for channels, playlists, videos and video groups - [REMOVAL] Remove
#average_view_duration_onmethod for channels, playlists, videos and video groups - [REMOVAL] Remove
#average_view_percentage_onmethod for channels, playlists, videos and video groups - [REMOVAL] Remove
#annotation_clicks_onmethod for channels, playlists, videos and video groups - [REMOVAL] Remove
#annotation_click_through_rate_onmethod for channels, playlists, videos and video groups - [REMOVAL] Remove
#annotation_close_rate_onmethod for channels, playlists, videos and video groups - [REMOVAL] Remove
#card_impressions_onmethod for channels, playlists, videos and video groups - [REMOVAL] Remove
#card_clicks_onmethod for channels, playlists, videos and video groups - [REMOVAL] Remove
#card_click_rate_onmethod for channels, playlists, videos and video groups - [REMOVAL] Remove
#card_teaser_impressions_onmethod for channels, playlists, videos and video groups - [REMOVAL] Remove
#card_teaser_clicks_onmethod for channels, playlists, videos and video groups - [REMOVAL] Remove
#card_teaser_click_rate_onmethod for channels, playlists, videos and video groups - [REMOVAL] Remove
#earnings_onmethod for channels, playlists, videos and video groups - [REMOVAL] Remove
#impressions_onmethod for channels, playlists, videos and video groups - [REMOVAL] Remove
#monetized_playbacks_onmethod for channels, playlists, videos and video groups - [REMOVAL] Remove
#playback_based_cpm_onmethod for channels, playlists, videos and video groups
- [FEATURE] Add
by: :subscribed_statusoption for reports, to return views (from acontent_owner.video) by subscribed status. - [FEATURE] Add
Yt::Collections::Reports::SUBSCRIBED_STATUSESto list all subscribed statuses supported by YouTube Analytics API.
- [ENHANCEMENT] Add newly available traffic sources: "Campaign card" and "End screen"
- [FEATURE] New
card impressionsreport for videos and channels. - [FEATURE] New
card clicksreport for videos and channels. - [FEATURE] New
card click ratereport for videos and channels. - [FEATURE] New
card teaser impressionsreport for videos and channels. - [FEATURE] New
card teaser clicksreport for videos and channels. - [FEATURE] New
card teaser click ratereport for videos and channels.
How to upgrade
If your code calls .favorites_added and .favorites_removed on channels and
videos then you must remove that code since those metrics are not anymore
supported by YouTube API.
- [REMOVAL] Remove deprecated
favorites_addedmetric for channels, videos, and video groups. - [REMOVAL] Remove deprecated
favorites_removedmetric for channels, videos, and video groups
- [IMPROVEMENT] Add
Yt::Claim#datato access the policy of a claim
- [FEATURE] Add
by: :operating_systemoption for reports, to return views (from acontent_owner.video) by operating system. - [FEATURE] Add
Yt::Collections::Reports::DEVICE_TYPESto list all device types supported by YouTube Analytics API. - [FEATURE] Add
Yt::Collections::Reports::OPERATING_SYSTEMSto list all operating systems supported by YouTube Analytics API.
- [IMPROVEMENT] Don’t combine forContentOwner and publishedBefore parameters in Search#list since YouTube does not support this anymore.
- [FEATURE] Add
VideoGroup#videosto load all videos under a group of channels, as well as a group of videos.
- [BUGFIX] Raise RequestError when authentication code is "invalid" or "already redeemed"
- [FEATURE] Make two methods
#explanationand#response_bodypublic forYt::Errors::RequestError
- [BUGFIX] Don’t try to eager load more than 50 assets at the time from claims
- [FEATURE] Add
ad_breaksandtp_ad_server_video_idattribute to AdvertisingOptionsSet
- [FEATURE] Eager-loading claims from videos will also eager-load assets.
- [FEATURE] New method -
Claim#sourcewill return the source of the claim.
- [BUGFIX] Fix where videos did not eager load claims or categories in subsequent requests.
- [BUGFIX] Don’t try to instantiate video.claim if a video does not have a claim.
- [FEATURE] Add ability for videos to eager load claims. For example,
$content_owner.videos.includes(:claim).first.claim.id.
- [BUGFIX] Previously, Yt was throttling queries for
quotaExceededresponses from YouTube. However, matchingquotaExceededwas too specific and would not have caught other limit exceeding responses from YouTube. This change will allow Yt to throttle other responses that containsExceededorexceeded.
- [BUGFIX] If no asset ID is set, calling ContentOwner#assets will now use the path, /youtube/partner/v1/assetSearch, instead of '/youtube/partner/v1/assets'
- [FEATURE] Add
comment_threadsassociation to Yt::Video. - [FEATURE] Add
top_level_commentand delegate its attributes (text_display,author_display_name,like_count,updated_at) to Yt::CommentThread.
- [FEATURE] Add Yt::Comment resource.
- [FEATURE] Add Yt::CommentThread resource.
- [BUGFIX] When
videos.where(..)returns more than one page, don’t retain the items for the next request.
- [IMPROVEMENT] Retry 3 times after a server error, to bypass temporary glitches by YouTube.
- [IMPROVEMENT] Don’t combine forMine and publishedBefore parameters in Search#list since YouTube does not support this anymore.
- [IMPROVEMENT] Deal with channels with more than 500 videos in a better way
- [BUGFIX] Add required 'require' to have
.with_indifferent_accessin geography
- [FEATURE] Add (undocumented) playback location dimensions SEARCH and BROWSE
- [FEATURE] Add
:group_itemsto Yt::VideoGroup (list items of a group) - [FEATURE] Add
:includes(:video)toYt::VideoGroup#group_items(eagerly loads all the videos)
- [FEATURE] Add Yt::COUNTRIES and Yt::US_STATES
- [FEATURE] Add YouTube Analytics Video Groups
- [FEATURE] Add
:video_groupsto Yt::Account (list video-groups created by an account) - [FEATURE] Add
:video_groupsto Yt::ContentOwner (list video-groups on behalf of a content owner) - [FEATURE] Add reports by video-group
- [FEATURE] Add
:videosto Yt::ContentOwner to list videos in network with a content owner
- [FEATURE] Add
access_token_was_refreshedto Yt::Account
- [FEATURE] Add
revoke_accessto Yt::Account
- [ENHANCEMENT] Add
:display_nameto each content owner returned by account.content_owners - [BUGFIX] Don’t raise error when raising MissingAuth without any scope
- [BUGFIX] Fix previous fix to Video#update with publishAt (typo)
- [BUGFIX] Fix Video#update with publishAt
- [ENHANCEMENT] Add "youtube.com/v/..." as possible URL for YouTube videos
- [ENHANCEMENT] Add eager loading to channel.playlists
- [FEATURE] Add Playlist#item_count
- [ENHANCEMENT] Add newly available traffic source: "Playlist page"
- [FEATURE] Retry the same request up to 3 times if YouTube responds with "quotaExceeded"
- [FEATURE] Retry the same request once if YouTube responds with "quotaExceeded"
- [FEATURE] New channel/video reports:
videos_added_to_playlists,videos_removed_from_playlists.
- [BUGIX] Correctly parse the YouTube response when requesting a refresh token with the wrong credentials.
- [FEATURE] Add
channel.related_playlistandaccount.related_playliststo access "Liked Videos", "Uploads", etc.
- [BUGFIX] Don’t run an infinite loop when calling
.playlist_items.includes(:video)on a playlist with only private or deleted videos
- [FEATURE] Add .includes(:video) to .playlist_items to eager-load video data of a list of playlist items.
- [ENHANCEMENT]
Yt::Video.newaccepts embedded video url.
How to upgrade
If your code expects 10 videos when calling a report by: :video or
by: :related_video, beware that those reports now return 25 videos.
If you only need the first 10, just add .first(10) to your result.
For instance: channel.views(by: :video).first(10).to_h.
- [ENHANCEMENT] Return 25 results on reports by video / related video.
- [FEATURE] New
playback_based_cpmreport for channels and videos.
- [BUGFIX] Don't break reports
by: :playlistwhen trying to fetch their part by limiting to result to 50 playlists.
- [BUGFIX] Let more than
max_resultsvideos be retrieved even when apublished_beforewhere condition is specified.
- [FEATURE] New
by: :weekoption for reports. - [FEATURE] New Video#age_restricted? method
- [ENHANCEMENT] Add
:videosoption to limit channel reports to subset of videos
- [ENHANCEMENT] When grouping by day, return results in chronological order
- [ENHANCEMENT] When grouping by device type, return results sorted by descending views
- [ENHANCEMENT] When grouping by traffic source, country, state or playback location, return results sorted by descending views
- [ENHANCEMENT] Add newly available traffic sources
- [BUGFIX] Don't raise error when YouTube returns a deleted video while eager loading
How to upgrade
If your code expects the estimated_minutes_watched
or the average_view_duration report to return a Float, beware that they now
return an Integer (since that is what YouTube returns).
In case you still need to parse a float, just append .to_f to the result.
- [ENHANCEMENT] Return Integer on
estimated_minutes_watchedreports - [ENHANCEMENT] Return Integer on
average_view_durationreports - [FEATURE] New
by: :referreroption for reports.
- [FEATURE] Accept
:includesin reports by video, related video and playlist to preload parts.
- [FEATURE] New
by: :monthoption for reports. - [FEATURE] New
.reportsmethod to fetch multiple metrics at once.
How to upgrade
If your code expects reports to return results by day then you must add
the by: :day option to your report method. The new default is by: :range.
For instance channel.views would return
{Wed, 8 May 2014 => 12.4, Thu, 9 May 2014 => 3.2, Fri, 10 May 2014 => …}
and now returns the same as calling channel.views by: :range:
{total: 3450}
Additionally, if you expect reports by day then you must specify the
:since option to your report method. Previously, this value was set to
5.days.ago, but now is required. :until still defaults to Date.today.
Finally, if you expect reports for the entire range, notice that the default
:since option is now set to the date when YouTube opened. Therefore calling a
method like channel.views now returns the lifetime views of a channel.
- [ENHANCEMENT] Change default from
by: :daytoby: :range. - [ENHANCEMENT] Require
:sinceoptions for any report by day. - [ENHANCEMENT] Change default range for reports by range to lifetime.
- [FEATURE] New
by: :search_termoption for reports. - [FEATURE] New
in: {state: 'XX'}option to limit reports to a US state - [FEATURE] New
uniques by: :dayreport
- [FEATURE] New
by: :countryoption for channel, video and playlist reports - [FEATURE] New
by: :stateoption for channel, video and playlist reports - [FEATURE] New
:inoption to limit reports to a country
How to upgrade
If your code expects any of the following method to return Float values, then
be aware that they now return Integer. You can still call to_f if you do need
a Float: views, comments, likes, dislikes, shares, subscribers_gained,
subscribers_lost, favorites_added, favorites_removed, annotations,
impressions, monetized_playbacks, playlist_starts.
- [ENHANCEMENT] Return
Integervalues for reports that can never return decimal digits. - [FEATURE] New
by: :rangeoption for reports, to return a metric without dimensions (that is, for the whole range)
How to upgrade
If your code doesn’t use PolicyRule#ACTIONS, then you are good to go.
If it does, then you should redefine the constant in your own app.
- [REMOVAL] Remove
PolicyRule#ACTIONS(was%q(block monetize takedown track)). - [BUGFIX] Make
account.playlistsandaccount.channel.playlistsbehave the same.
How to upgrade
If your code doesn’t use any of the following constants that were public but undocumented, then you are good to go.
If it does, then you should redefine those constants in your own app, since it’s not Yt’s goal to validate the values posted to YouTube API.
- [REMOVAL] Remove
Asset#STATUSES(was%q(active inactive pending)). - [REMOVAL] Remove
Claim#STATUSES(was%q(active appealed disputed inactive pending potential takedown unknown)). - [REMOVAL] Remove
Claim#CONTENT_TYPES(was%q(audio video audiovisual)). - [REMOVAL] Remove
Reference#STATUSES(was%q(activating active checking computing_fingerprint deleted duplicate_on_hold inactive live_streaming_processing urgent_reference_processing)). - [REMOVAL] Remove
Reference#CONTENT_TYPES(was%q(audio video audiovisual)). - [REMOVAL] Remove
Status#PRIVACY_STATUSES(was%q(private public unlisted)).
How to upgrade
If your code never calls partnered_channels.includes(:viewer_percentages) on
a Yt::ContentOwner, then you are good to go.
If it does, then be aware that viewer percentage is not eager-loaded anymore,
so the call above is equivalent to partenered_channels. The reason is that
viewer percentage requires a time-range, and using a default range of the
last 3 months can generate more confusion than added value.
Also if your code still uses the deprecated:
.viewer_percentagesmethod, replace with.viewer_percentage.policy.time_updatedmethod, replace withpolicy.updated_at.video.uploaded?method, replace withvideo.uploading?.
- [REMOVAL] Remove
.includes(:viewer_percentages)oncontent_owner.partnered_channels. - [REMOVAL] Remove deprecated
viewer_percentages(useviewer_percentageinstead) - [REMOVAL] Remove deprecated
policy.time_updated(useupdated_atinstead) - [REMOVAL] Remove deprecated
video.uploaded?(useuploading?instead)
How to upgrade
If your code never calls public?, private? or unlisted? on a Status
object, then you are good to go.
If it does, then call the same methods on the parent Resource object instead.
For instance, replace video.status.private? with video.private?.
- [ENHANCEMENT] Don’t over-delegate privacy status methods of Resource.
How to upgrade
If your code never calls video-specific methods on video.status, then you are
good to go.
If it does, then call the same methods on video, rather than video.status.
For instance, replace video.status.deleted? with video.deleted?.
- [ENHANCEMENT] Don’t over-delegate methods of Video.
- [ENHANCEMENT] Complete documentation of Yt::Video.
How to upgrade
If your code never calls video.uploaded?, then you are good to go.
If it does, then replace your calls with video.uploading?.
In fact, the YouTube constant uploaded identifies the status where a
video is being uploaded.
- [ENHANCEMENT] Rename
uploaded?touploading?to avoid confusion.
- [FEATURE] New
file_size,file_type,containermethods for Yt::Video. - [BUGFIX] Retrieve
category_idalso for videos obtained through a search. - [FEATURE] Add .includes(:category) to .videos in order to eager-load category title and ID of a collection of videos
- [FEATURE] New
embed_htmlmethod for Yt::Video.
- [FEATURE] New
annotation clicksreport for videos and channels. - [FEATURE] New
annotation click-through ratereport for videos and channels. - [FEATURE] New
annotation close ratereport for videos and channels.
How to upgrade
If your code never calls the viewer_percentage(gender: [:female|:male]) method
on a Channel or Video object, then you are good to go.
If it does, then replace your calls to viewer_percentage(gender: :female)
with viewer_percentage(by: gender)[:female], and do the same for :male.
Note that the plural viewer_percentages method still works but it’s
deprecated: you should use viewer_percentage instead.
- [ENHANCEMENT] Remove
:genderoption inviewer_percentagein favor of a more generic:by - [FEATURE] New
by: :genderoption for reports, to return viewer percentage by gender - [FEATURE] New
by: :age_groupoption for reports, to return viewer percentage by age group - [ENHANCEMENT] The viewer percentage report now accepts start/end date options (like any other report)
- [DEPRECATION] Deprecate
viewer_percentagesin favor ofviewer_percentage.
- [FEATURE] New
by: :device_typeoption for reports, to return views and estimated watched minutes (channels) by device
- [BUGFIX] Rescue OpenSSL::SSL::SSLErrorWaitReadable only on version of Ruby that define it.
- [BUGFIX] Raise
Yt::Errors::RequestErrorwhen passing an invalid path or URL toupload_thumbnail
- [FEATURE] New
by: :embedded_player_locationoption for reports, to return views and estimated watched minutes (channels) by URL where the player was embedded - [FEATURE] New
by: :playback_locationoption for reports, to return views and estimated watched minutes (channels) by watch/embedded/channel/external app/mobile. - [FEATURE] New
by: :related_videooption for reports, to return views and estimated watched minutes (channels) by the video that linked there.
- [BUGFIX] Don't let request errors crash Yt in Ruby 1.9.3.
- [FEATURE] Make
Annotation#texta public method. - [FEATURE] Make
dataa public method for Snippet, Status, ContentDetail and StatisticsSet. - [FEATURE] Add .includes to .videos, so you can eager load snippet, status, statistics and content details for a collection of videos
- [FEATURE] New
monetized playbacksreport for channels. - [FEATURE] New
estimated watched minutesreport for videos. - [FEATURE] New video reports:
average_view_duration,average_view_percentage. - [FEATURE] New
by: :playlistoption for reports, to return views and estimated watched minutes (channels) by playlist. - [FEATURE] New playlist reports:
views,playlist_starts,average_time_in_playlist,views_per_playlist_start.
- [FEATURE] New
by: :traffic_sourceoption for reports, to return views (channels/videos) and estimated watched minutes (channels) by traffic source. - [FEATURE] New
by: :videooption for reports, to return views and estimated watched minutes (channels) by video.
- [FEATURE] New channel/video reports:
favorites_added,favorites_removed.
- [FEATURE] New channel reports:
subscribers_gained,subscribers_lost. - [FEATURE] New video reports:
subscribers_gained,subscribers_lost. - [FEATURE] New channel reports:
estimated_minutes_watched,average_view_duration,average_view_percentage.
- [FEATURE] New
video.upload_thumbnailto upload the thumbnail for a video.
- [ENHANCEMENT] Accept
force: trueinauthentication_urlto force approval prompt.
- [FEATURE] AssetSearch resources available.
- [FEATURE] Access asset metadata (
effectiveandmine) via the asset object. - [ENHANCEMENT] Support
isManualClaimparameter in claims#insert.
- [FEATURE] New video reports: monetized playbacks.
- [ENHANCEMENT] Accept
includes(:viewer_percentages)in.partnered_channelsto eager-load multiple viewer percentages at once. - [ENHANCEMENT] Accept
wherein ViewerPercentages to collect data for multiple channels at once. - [ENHANCEMENT] Accept
partin thewhereclause of Channels, so statistics can be loaded at once.
- [ENHANCEMENT] Add
advertising_options_setandad_formatsto video
- [ENHANCEMENT] Accept
policy(with custom set of rules) incontent_owner.create_claim
- [BUGFIX] Rescue OpenSSL::SSL::SSLErrorWaitReadable raised by YouTube servers.
- [FEATURE] Add
release!to Ownership.
- [BUGFIX] Make list videos by id work for exactly 50 ids.
How to upgrade
If your code never calls the create_playlist on a Channel object, then you
are good to go.
If it does, then replace your calls to channel.create_playlist with
account.create_playlist, that is, call create_playlist on the channel’s
account instead.
- [ENHANCEMENT] Remove
create_playlistfrom Channel (still exists on Account) - [ENHANCEMENT] Accept
category_idinupload_video.
- [ENHANCEMENT] Accept
partin thewhereclause of Videos, so statistics and content details can be eagerly loaded.
- [ENHANCEMENT] Add
positionoption to add_video (to specify where in a playlist to add a video) - [FEATURE] Add
updateto PlaylistItem (to change the position of the item in the playlist)
How to upgrade
If your code never calls the delete method directly on a Subscription
object (to delete subscriptions by id), then you are good to go.
If it does, then be aware that trying to delete an unknown subscription will
now raise a RequestError, and will not accept ignore_errors as an option:
account = Yt::Account.new access_token: 'ya29...'
subscription = Yt::Subscription.new id: '--unknown-id--', auth: account
# old behavior
subscription.delete ignore_errors: true # => false
# new behavior
subscription.delete # => raises Yt::Errors::RequestError "subscriptionNotFound"
Note that the unsubscribe and unsubscribe! methods of Channel have not
changed, so you can still try to unsubscribe from a channel and not raise an
error by using the unsubscribe method:
account = Yt::Account.new access_token: 'ya29...'
channel = Yt::Channel.new id: 'UC-CHANNEL-ID', auth: account
channel.unsubscribe # => returns falsey if you were not subscribed
channel.unsubscribe! # => raises Yt::Errors::RequestError if you were not subscribed
- [ENHANCEMENT] Replace
has_many :subscriptionswithhas_one :subscriptionin Channel - [FEATURE] Add
subscribed_channelsto Channel (list which channels the channel is subscribed to) - [FEATURE] Add
subscribersto Account (list which channels are subscribed to an account)
- [BUGFIX] Make Resource.new(url: url).title hit the right endpoint
- [BUGFIX] Make videos.where(id: 'jNQXAC9IVRw').first.id return 'jNQXAC9IVRw'
- [ENHANCEMENT] Add Video search even by id, chart or rating
- [FEATURE] Add
ActiveSupport::Notificationto inspect HTTP requests
- [FEATURE] Add
updatemethod to Asset model
- [FEATURE] Add AdvertisingOptionsSet with
updateto change the advertising settings of a video - [FEATURE] Add
content_owner.create_claimandclaim.delete - [FEATURE] Add
updatemethod to Ownership to change owners of an asset - [FEATURE] Add
asset.ownershipto list the owners of an asset - [FEATURE] Add
content_owner.create_assetand Asset model
- [ENHANCEMENT] Add Video search even without a parent account or channel
For instance, to search for the most viewed video on the whole YouTube, run:
videos = Yt::Collections::Videos.new
videos.where(order: 'viewCount').first.title #=> "PSY - GANGNAM STYLE"
How to upgrade
When a request to YouTube fails, Yt used to print out a verbose error message, including the response body and the request that caused the error (in curl format). This output could include sensitive data (such as the authentication token). For security reasons, Yt will not print it out anymore by default.
If this is acceptable, then you are good to go.
If you want the old behavior, set the log_level of Yt to :debug:
Yt.configure do |config|
config.log_level = :debug
end
- [ENHANCEMENT] Add
log_levelto Yt.configuration
- [ENHANCEMENT] Use PATCH rather than PUT to partially update a MatchPolicy
- [BUGFIX] List tags of videos retrieved with channel.videos and account.videos
- [FEATURE] Add methods to insert and delete ContentID references
- [FEATURE] Add
.match_reference_idto Claim model
- [FEATURE] Add
MatchPolicyclass with.updateto change the policy used by an asset
- [BUGFIX] Make Yt work on Ruby 1.9.3 / ActiveSupport 3.0 again (was broken by 0.10.0)
How to upgrade
If your code never calls the size method to count how many items a list of
results has (e.g., how many videos an account has), then you are good to go.
If it does, then be aware that size will now return try to the number of
items as specified in the "totalResults" field of the first page of the YouTube
response, rather than loading all the pages (possibly thousands) and counting
exactly how many items are returned.
If this is acceptable, then you are good to go.
If you want the old behavior, replace size with count:
account = Yt::Account.new access_token: 'ya29...'
# old behavior
account.videos.size # => retrieved *all* the pages of the account’s videos
# new behavior
account.videos.size # => retrieves only the first page, returning the totalResults counter
account.videos.count # => retrieves *all* the pages of the account’s videos
- [ENHANCEMENT] Calling
sizeon a collection does not load all the pages of the collection - [ENHANCEMENT] Alias
policy.time_updatedto more coherentpolicy.updated_at
- [FEATURE] Add
.content_ownerand.linked_atto channels managed by a CMS content owner
- [BUGFIX] Correctly parse videos’ duration for videos longer than 24 hours
- [ENHANCEMENT] Accept angle brackets characters in videos’ and playlists’ metadata
- [FEATURE] Allow status attributes of a video to be updated
video.update now accepts three new attributes: privacy_status,
public_stats_viewable and publish_at.
- [FEATURE] Expose metadata for live-streaming videos
New method are now available for Video instance to check their live-streaming
details: actual_start_time, actual_end_time, scheduled_start_time,
scheduled_end_time and concurrent_viewers.
- [BUGFIX] Don’t cache
.whereconditions on multiple calls
For instance, invoking account.videos.where(q: 'x').count followed by
account.videos.count used to return the same result, because the where
conditions of the first request were wrongly kept for the successive request.
- [FEATURE] Check if a ContentID claim is third-party with
claim.third_party? - [ENHANCEMENT]
updatemethods accept both underscore and camel-case attributes
For instance, either of the following syntaxes can now be used:
video.update categoryId: "22" or video.update category_id: "22".
- [FEATURE] List ContentID policies with
content_owner.policies
- [FEATURE] List ContentID references with
content_owner.references - [ENHANCEMENT]
playlist.updateaccepts bothprivacyStatusandprivacy_status
For instance, either of the following syntaxes can now be used:
playlist.update privacyStatus: "unlisted" or
playlist.update privacy_status: "unlisted".
How to upgrade
If your code never declares instances of Yt::Rating, or never calls the
update method on them, then you are good to go.
If it does, then simply replace update with set:
rating = Yt::Rating.new
# old syntax
rating.update :like
# new syntax
rating.set :like
- [ENHANCEMENT]
rating.setreplacesrating.updateto rate a video
- [FEATURE] Delete a video with
video.delete
- [BUGFIX] Correctly parse annotations with timestamp written as
t='0'
- [FEATURE] List content owners managed by an account with
account.content_owners
- [FEATURE] List ContentID claims administered by a content owner with
content_owner.claims
- [FEATURE] Include all the video-related status information in
video.status
New method are now available for Video instance to check their status
information: public?, uploaded?, rejected?, failed?, processed?,
deleted?, uses_unsupported_codec?, has_failed_conversion?, empty?,
invalid?, too_small?, aborted?, claimed?, infringes_copyright?,
duplicate?, inappropriate?, too_long?, belongs_to_closed_account?,
infringes_trademark?, violates_terms_of_use?, has_public_stats_viewable?,
belongs_to_suspended_account?, scheduled?, scheduled_at, embeddable?
licensed_as_creative_commons? and licensed_as_standard_youtube?.
How to upgrade
If your code never declares instances of Yt::Channel, or never calls the
subscribe method on them, then you are good to go.
If it does, then be aware that subscribe will not raise an error anymore if
a YouTube user tries to subscribe to her/his own YouTube channel. Instead,
subscribe will simply return nil.
If this is acceptable, then you are good to go.
If you want the old behavior, replace subscribe with subscribe!:
account = Yt::Account.new access_token: 'ya29...'
channel = account.channel
# old behavior
channel.subscribe # => raised an error
# new behavior
channel.subscribe # => nil
channel.subscribe! # => raises an error
- [ENHANCEMENT]
channel.subscribedoes not raise error when trying to subscribe to one’s own channel
- [breaking change] Rename DetailsSet to ContentDetail
- Add statistics_set to Video (views, likes, dislikes, favorites, comments)
- Add statistics_set to Channel (views, comments, videos, subscribers)
- More snippet methods for Video (channel_id, channel_title, category_id, live_broadcast_content)
- More snippet methods for Playlist (channel_id, channel_title)
- More snippet methods for PlaylistItem (channel_id, channel_title, playlist_id, video_id)
- More status methods for PlaylistItem (privacy_status, public?, private?, unlisted?)
- Add video.update to update title, description, tags and categoryId of a video
- Sort channel.videos by most recent first
- Extract Reports (earnings, views) into module with macro
has_report - New channel reports: comments, likes, dislikes, shares and impressions
- Allow both normal and partnered channels to retrieve reports about views, comments, likes, dislikes, shares
- Make reports available also on Video (not just Channel)
- New account.upload_video to upload a video (either local or remote).
- Make channel.videos access more than 500 videos per channel
- Add viewer percentage (age group, gender) to Channel and Video reports
- [breaking change] Rename Channel#earning to Channel#earnings_on
- [breaking change] Account#videos shows all videos owned by account (public and private)
- Add the .status association to every type of resource (Channel, Video, Playlist)
- Allow account.videos to be chained with .where, such as in account.videos.where(q: 'query')
- Retry request once when YouTube times out
- Handle annotations with "never" as the timestamp, without text, singleton positions, of private videos
- New methods for Video: hd?, stereoscopic?, captioned?, licensed?
- More complete custom exception Yt::Error, with code, body and curl
- Replace
:ignore_not_foundand:ignore_duplicateswith:ignore_errors - Allow resources to be initialized with a url, such as Yt::Resource.new url: 'youtube.com/fullscreen'
- Add
has_one :idto resources, to retrieve the ID of resources initialized by URL - Raise an error if some
has_oneassociations are not found (id, snippet, details set, user info) - Don't check for the right :scope if Account is initialized with credentials
- Move models in Yt::Models but still auto-include them in the main namespace
- New Authentication model to separate
access_tokenandrefresh_tokenfrom Account - New types of Errors that render more verbose errors and the failing request in cURL syntax
- Separate Error class for 500 error, so they can be easily found in app logs
- New Earning collection to retrieve estimated earning for YouTube-partnered channels
- Rename error classes so they match the corresponding Net::HTTP errors (e.g. Unauthorized)
- Separate Error class for 403 Error
- Retry once YouTube earning queries that return error 400 "Invalid query. Query did not conform to the expectations"
- Update RSpec to 3.0 (only required in development/testing)
- New ContentOwner subclass of Account with access to partnered channels
- Automatically refresh the access token when it expires or becomes invalid
- Retry once YouTube earning queries that return error 503
- Wait 3 seconds and retry every request that returns 500, 503 or 400 with "Invalid query"
- New Views collection to retrieve view count for YouTube-partnered channels
- Complete rewrite, using ActiveSupport and separating models and collections
- New methods to handle annotations, details sets
- Supports also ActiveSupport 3 and Ruby 1.9.3 (not just AS4 + Ruby 2)
- Fix parsing annotation and timestamps longer than 1 hour
- Fix delegating tags from resources to snippets
- Two options to add videos to a playlist: fail or not if a video is missing or its account terminated
- Allow to configure Yt credentials through environment variables
- When updating a playlist, only changes the specified attributes
- New and improved methods to handle subscriptions, playlists, playlist items
find_or_create_playlist_bydoes not yield a block anymoreaccount.subscribe_to!raises error in case of duplicate subscription, butaccount.subscribe_todoes not
account.subscribe_to!does not raise error in case of duplicate subscription- Accountable objects can be initialized with the OAuth access token if there's no need to get a fresh one with a refresh token
- Replaced
account.perform!withaccount.like!,account.subscribe_to! - Added
account.add_to!to add a video to an account’s playlist - Added
account.find_or_create_playlist_byto find or create an account’s playlist
- Added support for Ruby 2.0.0
- Support for authenticated resources: Youtube accounts and Google accounts
- Support for public Youtube resources: channels and videos
- Available actions for authenticated Youtube accounts: like a video, subscribe to a channel