From 4d51a809dd4429628e5d3c75245e5bbe98622d83 Mon Sep 17 00:00:00 2001 From: claudiob Date: Mon, 27 Jul 2015 11:12:54 -0700 Subject: [PATCH] Add `related_playlist` to Account and Channel With related_playlists, you can retrieve special playlists associated to a channel such as "Liked videos" or "Uploads" Closes #218 --- CHANGELOG.md | 4 + README.md | 2 +- YOUTUBE_IT.md | 102 +++++++------------- lib/yt/actions/list.rb | 10 +- lib/yt/collections/related_playlists.rb | 43 +++++++++ lib/yt/models/account.rb | 6 ++ lib/yt/models/channel.rb | 6 ++ lib/yt/version.rb | 2 +- spec/requests/as_account/account_spec.rb | 1 + spec/requests/as_account/channel_spec.rb | 1 + spec/requests/as_server_app/channel_spec.rb | 2 + 11 files changed, 107 insertions(+), 72 deletions(-) create mode 100644 lib/yt/collections/related_playlists.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index 99b11082..b9c47a34 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ For more information about changelogs, check [Keep a Changelog](http://keepachangelog.com) and [Vandamme](http://tech-angels.github.io/vandamme). +## 0.25.4 - 2015-07-27 + +* [FEATURE] Add `channel.related_playlist` and `account.related_playlists` to access "Liked Videos", "Uploads", etc. + ## 0.25.3 - 2015-07-23 * [BUGFIX] Don’t run an infinite loop when calling `.playlist_items.includes(:video)` on a playlist with only private or deleted videos diff --git a/README.md b/README.md index 8b62b1a7..bf87c0b9 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ To install on your system, run To use inside a bundled Ruby project, add this line to the Gemfile: - gem 'yt', '~> 0.25.3' + gem 'yt', '~> 0.25.4' Since the gem follows [Semantic Versioning](http://semver.org), indicating the full version in your Gemfile (~> *major*.*minor*.*patch*) diff --git a/YOUTUBE_IT.md b/YOUTUBE_IT.md index 9cc63467..0ffddfd5 100644 --- a/YOUTUBE_IT.md +++ b/YOUTUBE_IT.md @@ -180,38 +180,19 @@ channel = Yt::Channel.new url: 'youtube.com/liz' channel.videos.where(q: 'penguin') ``` - - Retrieve video by ID: ```ruby @@ -509,32 +490,16 @@ client.delete_comment(video_id, comment_id) # with yt: not supported (was removed from YouTube API V3) ``` - +Remove Video From Watch Later Playlist: +```ruby +# with youtube_it +client.delete_video_from_watchlater(watchlater_entry_id) +# with yt +account = Yt::Account.new access_token: 'access_token' +watch_later = account.related_playlists.find{|p| p.title == 'Watch Later'} +watch_later.delete_playlist_items video_id: video_id +```