Client for DailyMotion API (http://www.dailymotion.com/doc/api/graph-api.html) written in Ruby.
Add this line to your application's Gemfile:
gem 'dailymotion-api-client'
And then execute:
$ bundle
Or install it yourself as:
$ gem install dailymotion-api-client
To use this client, you need to register an account at Dailymotion and create an API key. You need an API key and API secret.
# Create an instance of DailymotionApi::Client
client = DailymotionApi::Client.new(username: "username", password: "password", api_key: "key", api_secret: "secret")
# Request an access token
client.request_access_token
# Request an upload url
client.generate_upload_url
# Post your video
client.post_video(File.new("my_video.mp4"))
# Create a video
client.create_video
# Update video metadata an publish it
client.publish_video(title: "my video", channel: "shortfilms", tags: "my_tag")
# Get basic metadata for a video with id "video_id"
client.get_video("video_id")
=> {"id"=>"video_id", "title"=>"my video", "channel"=>"shortfilms", "owner"=>"owner_id"}
# Get specific fields for a video with id "video_id"
client.get_video("video_id", "url,title")
=> {"url"=>"http://www.dailymotion.com/video/video_id_my-video_shortfilms", "title"=>"my video"}
client.request_access_token
client.get_authenticated_user_info
=> {"id"=>"owner_id", "screenname"=>"username"}
client.get_authenticated_user_info("screenname")
=> {"screenname"=>"username"}
client.request_access_token
client.get_authenticated_user_videos
=> {"page"=>1, "limit"=>10, "explicit"=>false, "total"=>1, "has_more"=>false, "list"=>[{"id"=>"video_id", "title"=>"my video", "channel"=>"shortfilms", "owner"=>"owner_id"}]}
client.get_authenticated_user_videos("url")
=> {"page"=>1, "limit"=>10, "explicit"=>false, "total"=>1, "has_more"=>false, "list"=>[{"url"=>"http://www.dailymotion.com/video/video_id_my-video_shortfilms"}]}
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request