No commit activity in last 3 years
No release in over 3 years
DailyMotion API Ruby client
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
>= 0

Runtime

 Project Readme

DailyMotion API Ruby Client

Build Status

Client for DailyMotion API (http://www.dailymotion.com/doc/api/graph-api.html) written in Ruby.

Installation

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

Usage

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")

Publishing a video

# 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")

Getting info about a published video

# 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"}

Getting info about authenticated user

client.request_access_token

client.get_authenticated_user_info
=> {"id"=>"owner_id", "screenname"=>"username"}

client.get_authenticated_user_info("screenname")
=> {"screenname"=>"username"}

Getting a list of videos published by authenticated user

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"}]}

Deleting a video

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request