Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added the experimental option to query for duration

  • Loading branch information...
commit 3c1f411c29bddc2865ae757f44dfbb72bdfbe4e7 1 parent 996a00e
@sairam authored
Showing with 20 additions and 8 deletions.
  1. +12 −8 README.rdoc
  2. +8 −0 lib/youtube_it/request/base_search.rb
View
20 README.rdoc
@@ -4,10 +4,10 @@
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
+ 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.
-
+
== INSTALLATION & SETUP:
* Create a youtube account.
* Create a developer key here http://code.google.com/apis/youtube/dashboard.
@@ -31,7 +31,7 @@ Creating a client:
Client with developer key:
$ client = YouTubeIt::Client.new(:dev_key => "developer_key")
-
+
Client with youtube account and developer key:
$ client = YouTubeIt::Client.new(:username => "youtube_username", :password => "youtube_passwd", :dev_key => "developer_key")
@@ -72,12 +72,16 @@ Fields Parameter(experimental features):
Filter by date
$ client.videos_by(:fields => {:published => ((Date.today)})
- $ client.videos_by(:fields => {:recorded => ((Date.today)})
+ $ client.videos_by(:fields => {:recorded => ((Date.today)})
Filter by date with range
$ client.videos_by(:fields => {:published => ((Date.today - 30)..(Date.today))})
- $ client.videos_by(:fields => {:recorded => ((Date.today - 30)..(Date.today))})
-
+ $ client.videos_by(:fields => {:recorded => ((Date.today - 30)..(Date.today))})
+
+ Filter by duration(in seconds) ( Greater than and Less than duration specified in seconds)
+ $ client.videos_by(:fields => {:published => ((Date.today - 30)..(Date.today)), :gt_duration => 300 })
+ $ client.videos_by(:fields => {:published => ((Date.today - 30)..(Date.today)), :lt_duration => 301 })
+
== VIDEO MANAGEMENT
Note: YouTube account, OAuth or AuthSub enables video management.
@@ -99,7 +103,7 @@ My Videos:
My Video:
$ client.my_video(video_id)
-
+
Profile Details:
$ client.profile(user) #default: current user
@@ -154,7 +158,7 @@ Add Video To Playlist:
Remove Video From Playlist:
$ client.remove_video_from_playlist(playlist_id, playlist_entry_id)
-
+
== ACCESS CONTROL LIST
You can give permissions in your videos, for example denied comments, rate, etc...
View
8 lib/youtube_it/request/base_search.rb
@@ -53,6 +53,14 @@ def fields_to_params(fields)
fields_param << "entry[yt:statistics/@viewCount > #{fields[:view_count]}]"
end
+ if fields[:gt_duration]
+ fields_param << "entry[media:group/yt:duration/@seconds > #{fields[:gt_duration]}]"
+ end
+
+ if fields[:lt_duration]
+ fields_param << "entry[media:group/yt:duration/@seconds < #{fields[:lt_duration]}]"
+ end
+
return "&fields=#{URI.escape(fields_param.join(","))}"
end
Please sign in to comment.
Something went wrong with that request. Please try again.