tubeclip 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 599048509195d673cf48a0fb4e3b3e17489f68ef
4
- data.tar.gz: 40da413e43a3d58dfaf8dad4875670ff49f677ee
3
+ metadata.gz: 2526bb6155c163002577085a87cc91f040f5e672
4
+ data.tar.gz: 464e853b657a55631025c17aa264256d775c6c2a
5
5
  SHA512:
6
- metadata.gz: 42fd33aca4b804a7e6b1d8e19370731b350fe4487bea91a428d5225838be9943893c2164b0ebac2272d82d773196951c744110ceefac96bb0412be46b7947350
7
- data.tar.gz: a111bc0e578b1f04af832d4c4cee165bf1fe35e6940b80e9ad5747922ff8e39590ad21f0869e9b7135d1e00cd8699952580e2b3d2654e0d8c2723ccb4e5b2bf0
6
+ metadata.gz: 323be48cebd38d594f8275d20ae3e4927155da57f1e08d6c75e61dd78ef103beab2a0f6fcde70438183c8cd799a4ae8fc491c5e72ff2bcf86ff07001d9888afc
7
+ data.tar.gz: b235a17e4db8f463f7b098c3b1da23bf952250be63a9d5e615ecc7d50f3da8b6b003e4883ee329b6c8047d0b0de0acead89a26b11e2612e9797ddbebc3107cda
data/README.md CHANGED
@@ -1,9 +1,9 @@
1
1
  # Tubeclip
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/tubeclip`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
3
+ Ok! Lets say there is a awesome ruby gem you want to use in your project and it haven't been updated for a long time. This is a ruby 2.3.1 and rails 5 updated version of [youtube_it](https://github.com/kylejginavan/youtube_it).
6
4
 
5
+ tubeclip is the most complete Ruby client for the YouTube GData API. It provides an easy way to access the latest and most complete access to YouTube's video API. In comparison with the earlier Youtube interfaces, this new API and library offers much-improved flexibility around executing complex search queries to obtain well-targeted video search results. In addition, standard video management including but not limited to uploading, deleting, updating, like, dislike, ratings and comments.
6
+
7
7
  ## Installation
8
8
 
9
9
  Add this line to your application's Gemfile:
@@ -14,28 +14,383 @@ gem 'tubeclip'
14
14
 
15
15
  And then execute:
16
16
 
17
+
17
18
  $ bundle
18
19
 
19
20
  Or install it yourself as:
20
21
 
22
+
21
23
  $ gem install tubeclip
22
24
 
23
- ## Usage
25
+ Note: Do forget to create a youtube account, create a developer key here http://code.google.com/apis/youtube/dashboard and tubeclip supports ClientLogin(YouTube account), OAuth or AuthSub authentication methods.
24
26
 
25
- TODO: Write usage instructions here
27
+ ## DEMO
26
28
 
27
- ## Development
29
+ You can checkout this [**SitePoint** Youtube on rails tutorial](https://www.sitepoint.com/youtube-rails/) .
30
+ Please use tubeclip gem or just use [youtube_it](https://github.com/kylejginavan/youtube_it) gem and rails 3/4
31
+
32
+ ## ESTABLISHING A CLIENT
28
33
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
34
+ Important: The Account Authentication API for OAuth 1.0, AuthSub and Client Login has been officially deprecated as of April 20, 2012. It will continue to work as per our deprecation policy(https://developers.google.com/accounts/terms), but we encourage you to migrate to OAuth 2.0 authentication as soon as possible. If you are building a new application, you should use OAuth 2.0 authentication.
30
35
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
36
+ Creating a client:
32
37
 
33
- ## Contributing
38
+ $ require 'tubeclip'
39
+ $ client = Tubeclip::Client.new
40
+
41
+ Client with developer key:
42
+
43
+ $ client = Tubeclip::Client.new(:dev_key => "developer_key")
44
+
45
+ Client with youtube account and developer key:
46
+
47
+ $ client = Tubeclip::Client.new(:username => "youtube_username", :password => "youtube_passwd", :dev_key => "developer_key")
48
+
49
+ Client with AuthSub:
50
+
51
+ $ client = Tubeclip::AuthSubClient.new(:token => "token" , :dev_key => "developer_key")
52
+
53
+ Client with OAuth:
54
+
55
+ $ client = Tubeclip::OAuthClient.new("consumer_key", "consumer_secret", "youtube_username", "developer_key")
56
+ $ client.authorize_from_access("access_token", "access_secret")
57
+
58
+ Client with OAuth2:
59
+
60
+ $ client = Tubeclip::OAuth2Client.new(client_access_token: "access_token", client_refresh_token: "refresh_token", client_id: "client_id", client_secret: "client_secret", dev_key: "dev_key", expires_at: "expiration time")
61
+
62
+ If your access token is still valid (be careful, access tokens may only be valid for about 1 hour), you can use the client directly. If you want to refresh the access token using the refresh token just do:
63
+
64
+ $ client.refresh_access_token!
65
+
66
+ * You can see more about oauth 2 in the wiki: https://github.com/kylejginavan/tubeclip/wiki/How-To:-Use-OAuth-2
67
+
68
+ ## PROFILES
69
+ you can use multiple profiles in the same account like that
70
+
71
+ $ profiles = client.profiles(['username1','username2'])
72
+ $ profiles['username1'].username, "username1"
73
+
74
+ ## VIDEO QUERIES
75
+
76
+ Note: Each type of client enables searching capabilities.
77
+
78
+ Basic Queries:
79
+
80
+ $ client.videos_by(:query => "penguin")
81
+ $ client.videos_by(:query => "penguin", :page => 2, :per_page => 15)
82
+ $ client.videos_by(:query => "penguin", :restriction => "DE")
83
+ $ client.videos_by(:query => "penguin", :author => "liz")
84
+ $ client.videos_by(:tags => ['tiger', 'leopard'])
85
+ $ client.videos_by(:categories => [:news, :sports])
86
+ $ client.videos_by(:categories => [:news, :sports], :tags => ['soccer', 'football'])
87
+ $ client.videos_by(:user => 'liz')
88
+ $ client.videos_by(:favorites, :user => 'liz')
89
+ $ client.video_by("FQK1URcxmb4")
90
+ $ client.video_by("https://www.youtube.com/watch?v=QsbmrCtiEUU")
91
+ $ client.video_by_user("chebyte","FQK1URcxmb4")
92
+
93
+ Standard Queries:
94
+
95
+ $ client.videos_by(:most_viewed)
96
+ $ client.videos_by(:most_linked, :page => 3)
97
+ $ client.videos_by(:top_rated, :time => :today)
98
+ $ client.get_all_videos(:top_rated, :time => :today)
99
+ $ client.videos_by(:top_rated, :region => "RU", :category => "News")
100
+ Advanced Queries (with boolean operators OR (either), AND (include), NOT (exclude)):
101
+ $ client.videos_by(:categories => { :either => [:news, :sports], :exclude => [:comedy] }, :tags => { :include => ['football'], :exclude => ['soccer'] })
102
+
103
+
104
+ Custom Query Params
105
+ You can use custom query params like that:
106
+
107
+ $ client.videos_by(:query => "penguin", :safe_search => "strict")
108
+ $ client.videos_by(:query => "penguin", :duration => "long")
109
+ $ client.videos_by(:query => "penguin", :hd => "true")
110
+ $ client.videos_by(:query => "penguin", :region => "AR")
111
+
112
+ you can see more options here https://developers.google.com/youtube/2.0/reference#yt_format
113
+
114
+ Fields Parameter(experimental features):
115
+ Return videos more than 1000 views
116
+
117
+ $ client.videos_by(:fields => {:view_count => "1000"})
118
+
119
+ Filter by date
120
+
121
+ $ client.videos_by(:fields => {:published => (Date.today)})
122
+ $ client.videos_by(:fields => {:recorded => (Date.today)})
123
+
124
+ Filter by date with range
125
+
126
+ $ client.videos_by(:fields => {:published => ((Date.today - 30)..(Date.today))})
127
+ $ client.videos_by(:fields => {:recorded => ((Date.today - 30)..(Date.today))})
128
+
129
+ Note: These queries do not find private videos! Use these methods instead:
130
+
131
+ $ client.my_video("FQK1URcxmb4")
132
+ $ client.my_videos(:query => "penguin")
133
+
134
+ ## VIDEO MANAGEMENT
135
+
136
+ Note: YouTube account, OAuth or AuthSub enables video management.
137
+
138
+ Upload Video:
139
+
140
+ $ client.video_upload(File.open("test.mov"), :title => "test",:description => 'some description', :category => 'People',:keywords => %w[cool blah test])
141
+
142
+ Upload Remote Video:
143
+
144
+ $ client.video_upload("http://url/myvideo.mp4", :title => "test",:description => 'some description', :category => 'People',:keywords => %w[cool blah test])
145
+
146
+
147
+ Upload Video With A Developer Tag (Note the tags are not immediately available):
148
+
149
+ $ client.video_upload(File.open("test.mov"), :title => "test",:description => 'some description', :category => 'People',:keywords => %w[cool blah test], :dev_tag => 'tagdev')
150
+
151
+ Upload Video from url:
152
+
153
+ $ client.video_upload("http://media.railscasts.com/assets/episodes/videos/412-fast-rails-commands.mp4", :title => "test",:description => 'some description', :category => 'People',:keywords => %w[cool blah test])
154
+
155
+ Upload Private Video:
156
+
157
+ $ client.video_upload(File.open("test.mov"), :title => "test",:description => 'some description', :category => 'People',:keywords => %w[cool blah test], :private => true)
158
+
159
+
160
+ Update Video:
161
+
162
+ $ client.video_update("FQK1URcxmb4", :title => "new test",:description => 'new description', :category => 'People',:keywords => %w[cool blah test])
163
+
164
+ Delete Video:
165
+
166
+ $ client.video_delete("FQK1URcxmb4")
167
+
168
+ My Videos:
169
+
170
+ $ client.my_videos
171
+
172
+ My Video:
173
+
174
+ $ client.my_video(video_id)
175
+
176
+ Profile Details:
177
+
178
+ $ client.profile(user) #default: current user
179
+
180
+ List Comments:
181
+
182
+ $ client.comments(video_id)
183
+
184
+ Add A Comment:
185
+
186
+ $ client.add_comment(video_id, "test comment!")
187
+
188
+ Add A Reply Comment:
189
+
190
+ $ client.add_comment(video_id, "test reply!", :reply_to => another_comment)
191
+
192
+ Delete A Comment:
193
+
194
+ $ client.delete_comment(video_id, comment_id)
195
+
196
+ List Favorites:
197
+
198
+ $ client.favorites(user) # default: current user
199
+
200
+ Add Favorite:
201
+
202
+ $ client.add_favorite(video_id)
203
+
204
+ Delete Favorite:
205
+
206
+ $ client.delete_favorite(favorite_entry_id)
207
+
208
+ Like A Video:
209
+
210
+ $ client.like_video(video_id)
34
211
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/tubeclip. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
212
+ Dislike A Video:
36
213
 
214
+ $ client.dislike_video(video_id)
215
+
216
+ List Subscriptions:
217
+
218
+ $ client.subscriptions(user) # default: current user
219
+
220
+ Subscribe To A Channel:
221
+
222
+ $ client.subscribe_channel(channel_name)
223
+
224
+ Unsubscribe To A Channel:
225
+
226
+ $ client.unsubscribe_channel(subscription_id)
227
+
228
+ List New Subscription Videos:
229
+
230
+ $ client.new_subscription_videos(user) # default: current user
231
+
232
+ List Playlists:
233
+
234
+ $ client.playlists(user, order_by) # default: current user, position
235
+
236
+ for example you can get the videos of your playlist ordered by title
237
+
238
+ $ client.playlists(user, "title")
239
+
240
+ you can see more about options for order_by here: https://developers.google.com/youtube/2.0/reference#orderbysp
241
+
242
+ Select Playlist:
243
+
244
+ $ client.playlist(playlist_id)
245
+
246
+ Select All Videos From A Playlist:
247
+
248
+ $ playlist = client.playlist(playlist_id)
249
+ $ playlist.videos
250
+
251
+ Create Playlist:
252
+
253
+ $ playlist = client.add_playlist(:title => "new playlist", :description => "playlist description")
254
+
255
+ Delete Playlist:
256
+
257
+ $ client.delete_playlist(playlist_id)
258
+
259
+ Add Video To Playlist:
260
+
261
+ $ client.add_video_to_playlist(playlist_id, video_id, position)
262
+
263
+ Remove Video From Playlist:
264
+
265
+ $ client.delete_video_from_playlist(playlist_id, playlist_entry_id)
266
+
267
+ Update Position Video From Playlist:
268
+
269
+ $ client.update_position_video_from_playlist(playlist_id, playlist_entry_id, position)
270
+
271
+ Select All Videos From your Watch Later Playlist:
272
+
273
+ $ watcher_later = client.watcherlater(user) #default: current user
274
+ $ watcher_later.videos
275
+
276
+ Add Video To Watcher Later Playlist:
277
+
278
+ $ client.add_video_to_watchlater(video_id)
279
+
280
+ Remove Video From Watch Later Playlist:
281
+
282
+ $ client.delete_video_from_watchlater(watchlater_entry_id)
283
+
284
+
285
+ List Related Videos
286
+
287
+ $ video = client.video_by("https://www.youtube.com/watch?v=QsbmrCtiEUU&feature=player_embedded")
288
+ $ video.related.videos
289
+
290
+ Add Response Video
291
+
292
+ $ video.add_response(original_video_id, response_video_id)
293
+
294
+ Delete Response Video
295
+
296
+ $ video.delete_response(original_video_id, response_video_id)
297
+
298
+ List Response Videos
299
+
300
+ $ video = client.video_by("https://www.youtube.com/watch?v=QsbmrCtiEUU&feature=player_embedded")
301
+ $ video.responses.videos
302
+
303
+
304
+ ## BATCH VIDEOS
305
+ you can list many videos at the same time
306
+
307
+ $ client.videos(['video_id_1', 'video_id_2',...])
308
+
309
+
310
+ ## ACCESS CONTROL LIST
311
+
312
+ You can give permissions in your videos, for example denied comments, rate, etc...
313
+ you can read more there http://code.google.com/apis/youtube/2.0/reference.html#youtube_data_api_tag_yt:accessControl
314
+ you have available the followings options:
315
+
316
+ * :rate, :comment, :commentVote, :videoRespond, :list, :embed, :syndicate
317
+
318
+ with just two values:
319
+ * allowed or denied
320
+
321
+ Example
322
+
323
+ client = Tubeclip::Client.new(:username => "youtube_username", :password => "youtube_passwd", :dev_key => "developer_key")
324
+
325
+ * upload video with denied comments
326
+
327
+ client.video_upload(File.open("test.mov"), :title => "test",:description => 'some description', :category => 'People',:keywords => %w[cool blah test], :comment => "denied")
328
+
329
+ ## Partial Updates
330
+ You can send a single PATCH request to add, replace and/or delete specific fields for a particular resource.
331
+
332
+ client.video_partial_update(video.unique_id, :list => 'denied', :embed => 'allowed')
333
+
334
+ ## User Activity
335
+ You can get user activity with the followings params:
336
+
337
+ $ client.activity(user) #default current user
338
+
339
+ ## Video Upload From Browser:
340
+
341
+ When uploading a video from your browser you need make a form upload with the followings params:
342
+ $ upload_token(params, nexturl)
343
+ params => params like :title => "title", :description => "description", :category => "People", :keywords => ["test"]
344
+ nexturl => redirect to this url after upload
345
+
346
+
347
+ Controller
348
+ def upload
349
+ @upload_info = Tubeclip::Client.new.upload_token(params, videos_url)
350
+ end
351
+
352
+ View (upload.html.erb)
353
+ <% form_tag @upload_info[:url], :multipart => true do %>
354
+ <%= hidden_field_tag :token, @upload_info[:token] %>
355
+ <%= label_tag :file %>
356
+ <%= file_field_tag :file %>
357
+ <%= submit_tag "Upload video" %>
358
+ <% end %>
359
+
360
+ ## WIDESCREEN VIDEOS
361
+
362
+ If the videos has support for widescreen:
363
+ $ video.embed_html_with_width(1280)
364
+
365
+ Note: you can specify width or just use the default of 1280.
366
+
367
+ ## USING HTML5
368
+
369
+ Now you can embed videos without use flash using html5, usefull for mobiles that not support flash but has html5 browser
370
+
371
+ You can specify these options
372
+ $ video.embed_html5({:class => 'video-player', :id => 'my-video', :width => '425', :height => '350', :frameborder => '1', :url_params => {:option_one => "value", :option_two => "value"},
373
+ fullscreen: true, :sandbox => "value"})
374
+
375
+ or just use with default options
376
+ $ video.embed_html5 #default: width: 425, height: 350, frameborder: 0
377
+
378
+ ## LOGGING
379
+
380
+ Tubeclip passes all logs through the logger variable on the class itself. In Rails context, assign the Rails logger to that variable to collect the messages
381
+ (don't forget to set the level to debug):
382
+ $ Tubeclip.logger = RAILS_DEFAULT_LOGGER
383
+ $ RAILS_DEFAULT_LOGGER.level = Logger::DEBUG
384
+
385
+ ## RUBY INTERPRETER COMPABILITY:
386
+
387
+ * 2.3.1
37
388
 
38
389
  ## License
39
390
 
40
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
391
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT)
392
+
393
+
394
+ ## Contributing
41
395
 
396
+ Bug reports and pull requests are welcome on GitHub at https://github.com/zPhumzani/tubeclip. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
@@ -1,3 +1,3 @@
1
1
  class Tubeclip
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/tubeclip.gemspec CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["zphumzani@gmail.com"]
11
11
 
12
12
  spec.summary = %q{Upload, delete, update, comment on youtube videos all from one gem.}
13
- spec.description = %q{Ruby wrapper for youtube api's}
13
+ spec.description = %q{Ruby wrapper for youtube api's. Upload, delete, update, comment on youtube videos all from one gem}
14
14
  spec.homepage = "https://github.com/zPhumzani/tubeclip"
15
15
  spec.license = "MIT"
16
16
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tubeclip
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - zPhumzani
@@ -182,7 +182,8 @@ dependencies:
182
182
  - - ">="
183
183
  - !ruby/object:Gem::Version
184
184
  version: '0'
185
- description: Ruby wrapper for youtube api's
185
+ description: Ruby wrapper for youtube api's. Upload, delete, update, comment on youtube
186
+ videos all from one gem
186
187
  email:
187
188
  - zphumzani@gmail.com
188
189
  executables: []