Permalink
Browse files

clone from kylejginavan/youtube_it ; removing commit history since it…

…s of size 140MB
  • Loading branch information...
0 parents commit 996a00e10e3c4aa056b47d42b1f8de62186bdb3d @sairam committed Nov 19, 2011
Showing with 3,808 additions and 0 deletions.
  1. +17 −0 .gitignore
  2. +36 −0 Manifest.txt
  3. +254 −0 README.rdoc
  4. +54 −0 Rakefile
  5. +1 −0 VERSION
  6. +76 −0 lib/youtube_it.rb
  7. +76 −0 lib/youtube_it/chain_io.rb
  8. +377 −0 lib/youtube_it/client.rb
  9. +24 −0 lib/youtube_it/middleware/faraday_authheader.rb
  10. +21 −0 lib/youtube_it/middleware/faraday_oauth.rb
  11. +30 −0 lib/youtube_it/middleware/faraday_youtubeit.rb
  12. +17 −0 lib/youtube_it/model/activity.rb
  13. +13 −0 lib/youtube_it/model/author.rb
  14. +11 −0 lib/youtube_it/model/category.rb
  15. +16 −0 lib/youtube_it/model/comment.rb
  16. +19 −0 lib/youtube_it/model/contact.rb
  17. +18 −0 lib/youtube_it/model/content.rb
  18. +11 −0 lib/youtube_it/model/playlist.rb
  19. +23 −0 lib/youtube_it/model/rating.rb
  20. +7 −0 lib/youtube_it/model/subscription.rb
  21. +17 −0 lib/youtube_it/model/thumbnail.rb
  22. +27 −0 lib/youtube_it/model/user.rb
  23. +241 −0 lib/youtube_it/model/video.rb
  24. +507 −0 lib/youtube_it/parser.rb
  25. +12 −0 lib/youtube_it/record.rb
  26. +72 −0 lib/youtube_it/request/base_search.rb
  27. +15 −0 lib/youtube_it/request/error.rb
  28. +43 −0 lib/youtube_it/request/standard_search.rb
  29. +47 −0 lib/youtube_it/request/user_search.rb
  30. +102 −0 lib/youtube_it/request/video_search.rb
  31. +433 −0 lib/youtube_it/request/video_upload.rb
  32. +41 −0 lib/youtube_it/response/video_search.rb
  33. +4 −0 lib/youtube_it/version.rb
  34. +1 −0 test/files/recorded_response.xml
  35. +53 −0 test/files/youtube_video_response.xml
  36. +10 −0 test/helper.rb
  37. BIN test/test.mov
  38. +63 −0 test/test_chain_io.rb
  39. +418 −0 test/test_client.rb
  40. +48 −0 test/test_field_search.rb
  41. +43 −0 test/test_video.rb
  42. +271 −0 test/test_video_feed_parser.rb
  43. +141 −0 test/test_video_search.rb
  44. +98 −0 youtube_it.gemspec
@@ -0,0 +1,17 @@
+.DS_Store
+.idea
+config/database.yml
+log/*.log
+public/flash/*.swf
+tmp/**/*
+*.tmproj
+public/stylesheets/packaged/*.css
+public/javascripts/packaged/*.js
+tmp
+log
+config/*.sphinx.conf
+db/sphinx/
+sphinx/**/*
+public/packages/*
+.gitconfig
+pkg/
@@ -0,0 +1,36 @@
+History.txt
+Manifest.txt
+README.txt
+Rakefile
+TODO.txt
+lib/youtube_it.rb
+lib/youtube_it/chain_io.rb
+lib/youtube_it/client.rb
+lib/youtube_it/model/author.rb
+lib/youtube_it/model/category.rb
+lib/youtube_it/model/contact.rb
+lib/youtube_it/model/content.rb
+lib/youtube_it/model/playlist.rb
+lib/youtube_it/model/rating.rb
+lib/youtube_it/model/thumbnail.rb
+lib/youtube_it/model/user.rb
+lib/youtube_it/model/video.rb
+lib/youtube_it/parser.rb
+lib/youtube_it/record.rb
+lib/youtube_it/request/base_search.rb
+lib/youtube_it/request/error.rb
+lib/youtube_it/request/standard_search.rb
+lib/youtube_it/request/user_search.rb
+lib/youtube_it/request/video_search.rb
+lib/youtube_it/request/video_upload.rb
+lib/youtube_it/response/video_search.rb
+lib/youtube_it/middleware/faraday_authheader.rb
+lib/youtube_it/middleware/faraday_oauth.rb
+lib/youtube_it/middleware/faraday_youtubeit.rb
+lib/youtube_it/version.rb
+test/helper.rb
+test/test_chain_io.rb
+test/test_client.rb
+test/test_video.rb
+test/test_video_search.rb
+
@@ -0,0 +1,254 @@
+== DESCRIPTION
+
+ youtube_it 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.
+
+== INSTALLATION & SETUP:
+ * Create a youtube account.
+ * Create a developer key here http://code.google.com/apis/youtube/dashboard.
+ * sudo gem install youtube_it
+
+Note: youtube_it supports ClientLogin(YouTube account), OAuth or AuthSub authentication methods.
+
+== Example Rails 3 App
+
+You can get an example how you can use youtube_it with Rails 3 here: http://github.com/chebyte/youtube_it_rails_app_example
+
+== DEMO
+
+You can see to youtube_it in action here: http://youtube-it.heroku.com
+
+== ESTABLISHING A CLIENT
+
+Creating a client:
+ $ require 'youtube_it'
+ $ client = YouTubeIt::Client.new
+
+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")
+
+Client with AuthSub:
+ $ client = YouTubeIt::AuthSubClient.new(:token => "token" , :dev_key => "developer_key")
+
+Client with OAuth:
+ $ client = YouTubeIt::OAuthClient.new("consumer_key", "consumer_secret", "youtube_username", "developer_key")
+ $ client.authorize_from_access("access_token", "access_secret")
+
+== VIDEO QUERIES
+
+Note: Each type of client enables searching capabilities.
+
+Basic Queries:
+ $ client.videos_by(:query => "penguin")
+ $ client.videos_by(:query => "penguin", :page => 2, :per_page => 15)
+ $ client.videos_by(:tags => ['tiger', 'leopard'])
+ $ client.videos_by(:categories => [:news, :sports])
+ $ client.videos_by(:categories => [:news, :sports], :tags => ['soccer', 'football'])
+ $ client.videos_by(:user => 'liz')
+ $ client.videos_by(:favorites, :user => 'liz')
+ $ client.video_by("FQK1URcxmb4")
+ $ client.video_by_user("chebyte","FQK1URcxmb4")
+
+Standard Queries:
+ $ client.videos_by(:most_viewed)
+ $ client.videos_by(:most_linked, :page => 3)
+ $ client.videos_by(:top_rated, :time => :today)
+
+Advanced Queries (with boolean operators OR (either), AND (include), NOT (exclude)):
+ $ client.videos_by(:categories => { :either => [:news, :sports], :exclude => [:comedy] }, :tags => { :include => ['football'], :exclude => ['soccer'] })
+
+
+Fields Parameter(experimental features):
+ Return videos more than 1000 views
+ $ client.videos_by(:fields => {:view_count => "1000"})
+
+ Filter by date
+ $ client.videos_by(:fields => {:published => ((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))})
+
+== VIDEO MANAGEMENT
+
+Note: YouTube account, OAuth or AuthSub enables video management.
+
+Upload Video:
+ $ client.video_upload(File.open("test.mov"), :title => "test",:description => 'some description', :category => 'People',:keywords => %w[cool blah test])
+
+Upload Video With A Developer Tag (Note the tags are not immediately available):
+ $ client.video_upload(File.open("test.mov"), :title => "test",:description => 'some description', :category => 'People',:keywords => %w[cool blah test], :dev_tag => 'tagdev')
+
+Update Video:
+ $ client.video_update("FQK1URcxmb4", :title => "new test",:description => 'new description', :category => 'People',:keywords => %w[cool blah test])
+
+Delete Video:
+ $ client.video_delete("FQK1URcxmb4")
+
+My Videos:
+ $ client.my_videos
+
+My Video:
+ $ client.my_video(video_id)
+
+Profile Details:
+ $ client.profile(user) #default: current user
+
+List Comments:
+ $ client.comments(video_id)
+
+Add A Comment:
+ $ client.add_comment(video_id, "test comment!")
+
+List Favorites:
+ $ client.favorites(user) # default: current user
+
+Add Favorite:
+ $ client.add_favorite(video_id)
+
+Delete Favorite:
+ $ client.delete_favorite(video_id)
+
+Like A Video:
+ $ client.like_video(video_id)
+
+Dislike A Video:
+ $ client.dislike_video(video_id)
+
+List Subscriptions:
+ $ client.subscriptions(user) # default: current user
+
+Subscribe To A Channel:
+ $ client.subscribe_channel(channel_name)
+
+Unsubscribe To A Channel:
+ $ client.unsubscribe_channel(subscription_id)
+
+List Playlists:
+ $ client.playlists(user) # default: current user
+
+Select Playlist:
+ $ client.playlist(playlist_id)
+
+Select All Videos From A Playlist:
+ $ playlist = client.playlist(playlist_id)
+ $ playlist.videos
+
+Create Playlist:
+ $ playlist = client.add_playlist(:title => "new playlist", :description => "playlist description")
+
+Delete Playlist:
+ $ client.delete_playlist(playlist_id)
+
+Add Video To Playlist:
+ $ client.add_video_to_playlist(playlist_id, video_id)
+
+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...
+ you can read more there http://code.google.com/apis/youtube/2.0/reference.html#youtube_data_api_tag_yt:accessControl
+ you have available the followings options:
+
+* :rate, :comment, :commentVote, :videoRespond, :list, :embed, :syndicate
+
+ with just two values:
+* allowed or denied
+
+ Example
+
+ client = YouTubeIt::Client.new(:username => "youtube_username", :password => "youtube_passwd", :dev_key => "developer_key")
+
+* upload video with denied comments
+
+ client.video_upload(File.open("test.mov"), :title => "test",:description => 'some description', :category => 'People',:keywords => %w[cool blah test], :comment => "denied")
+
+
+== Video Upload From Browser:
+
+When uploading a video from your browser you need make a form upload with the followings params:
+ $ upload_token(params, nexturl)
+params => params like :title => "title", :description => "description", :category => "People", :tags => ["test"]
+nexturl => redirect to this url after upload
+
+
+Controller
+ def upload
+ @upload_info = YouTubeIt::Client.new.upload_token(params, videos_url)
+ end
+
+View (upload.html.erb)
+ <% form_tag @upload_info[:url], :multipart => true do %>
+ <%= hidden_field_tag :token, @upload_info[:token] %>
+ <%= label_tag :file %>
+ <%= file_field_tag :file %>
+ <%= submit_tag "Upload video" %>
+ <% end %>
+
+== WIDESCREEN VIDEOS
+
+If the videos has support for widescreen:
+ $ video.embed_html_with_width(1280)
+
+Note: you can specify width or just use the default of 1280.
+
+== USING HTML5
+
+Now you can embed videos without use flash using html5, usefull for mobiles that not support flash but has html5 browser
+
+You can specify these options
+ $ video.embed_html5({:class => 'video-player', :id => 'my-video', :width => '425', :height => '350', :frameborder => '1'})
+
+or just use with default options
+ $ video.embed_html5 #default: width: 425, height: 350, frameborder: 0
+
+== LOGGING
+
+YouTubeIt 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
+(don't forget to set the level to debug):
+ $ YouTubeIt.logger = RAILS_DEFAULT_LOGGER
+ $ RAILS_DEFAULT_LOGGER.level = Logger::DEBUG
+
+== CONTRIBUTORS:
+
+* Kyle J. Ginavan.
+* Mauro Torres - http://github.com/chebyte
+* Marko Seppa - https://github.com/mseppae
+* Walter Korman - https://github.com/shaper
+* Shane Vitarana - https://github.com/shanev
+
+== LICENSE:
+
+MIT License
+
+Copyright (c) 2010 Kyle J. Ginavan
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+'Software'), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,54 @@
+require 'rubygems'
+require 'rake'
+
+begin
+ require 'jeweler'
+ Jeweler::Tasks.new do |gem|
+ gem.name = "youtube_it"
+ gem.summary = %Q{The most complete Ruby wrapper for youtube api's}
+ gem.description = %Q{Upload, delete, update, comment on youtube videos all from one gem.}
+ gem.email = "kylejginavan@gmail.com"
+ gem.homepage = "http://github.com/kylejginavan/youtube_it"
+ gem.add_dependency('oauth','>=0.4.4')
+ gem.add_dependency('simple_oauth', '>=0.1.5')
+ gem.add_dependency('faraday','>=0.7.3')
+ gem.add_dependency('builder')
+ gem.authors = ["kylejginavan","chebyte", "mseppae"]
+ end
+ Jeweler::GemcutterTasks.new
+rescue LoadError
+ puts "youtube_it (or a dependency) not available. Install it with: gem install youtube_it"
+end
+
+require 'rake/testtask'
+Rake::TestTask.new(:test) do |test|
+ test.libs << 'test'
+ test.pattern = 'test/**/test_*.rb'
+ test.verbose = true
+end
+
+begin
+ require 'rcov/rcovtask'
+ Rcov::RcovTask.new do |test|
+ test.libs << 'test'
+ test.pattern = 'test/**/test_*.rb'
+ test.verbose = true
+ end
+rescue LoadError
+ task :rcov do
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
+ end
+end
+
+task :default => :test
+
+require 'rake/rdoctask'
+Rake::RDocTask.new do |rdoc|
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
+
+ rdoc.rdoc_dir = 'rdoc'
+ rdoc.title = "constantations #{version}"
+ rdoc.rdoc_files.include('README*')
+ rdoc.rdoc_files.include('lib/**/*.rb')
+end
+
@@ -0,0 +1 @@
+2.0.1
Oops, something went wrong.

0 comments on commit 996a00e

Please sign in to comment.