Dailymotion - API Explorerで、リクエストとレスポンスを確認できます。
GET https://api.dailymotion.com/videos
| パラメータ | 説明 |
|---|---|
| fields | レスポンスで受け取るフィールドのリスト |
| channel | 動画のチャンネル |
| filters | A list of filters available to reduce the result set. |
| ids | Limit the result to a specified list of video ids. |
| language | The language of the video (declarative). |
| owner | The id of the owner of the video.
(use "owner.screenname" to show the user name) |
| search | 検索キーワード |
| sort | 検索結果の順番 |
| tags | 動画のタグのリスト |
| page | 読み込むページ番号。最大値は100 |
| limit | 取得する項目の最大数。最大値は100 |
これ以外にも、API共通のパラメータがあります。
fieldsパラメータで、レスポンスで受け取るフィールド (動画のメタデータ) を指定できます。複数のパラメータはカンマ (,) で区切って指定しますが、実際にはURLエンコードする必要があるため「%2C」で区切ります。
| 区分 | パラメータ | 説明 |
|---|---|---|
| 3d | ||
| access_error | ||
| ads | ||
| allow_comments | ||
| allow_embed | ||
| aspect_ratio | ||
| available_formats | ||
| bookmarks_total | ||
| チャンネル | channel | |
| channel.description | ||
| channel.id | ||
| channel.name | ||
| comments_total | ||
| ロケール | country | 国名 |
| language | 言語 | |
| created_time | ||
| modified_time | ||
| description | ||
| duration | ||
| embed_html | ||
| embed_url | ||
| encoding_progress | ||
| explicit | ||
| filmstrip_small_url | ||
| geoblocking | ||
| id | ||
| isrc | ||
| live_hd_publish_url | ||
| live_hq_publish_url | ||
| live_publish_url | ||
| live_sd_publish_url | ||
| mediablocking | ||
| mode | ||
| onair | ||
| 投稿者 | owner | 投稿者 |
| owner.avatar_large_url | ||
| owner.avatar_medium_url | ||
| owner.avatar_small_url | ||
| owner.birthday | ||
| owner.created_time | ||
| owner.description | ||
| owner.email | ||
| owner.fullname | ||
| owner.gender | ||
| owner.id | ||
| owner.language | ||
| owner.screenname | ||
| owner.status | ||
| owner.type | ||
| owner.url | ||
| owner.username | ||
| owner.videos_total | ||
| owner.videostar | ||
| owner.views_total | ||
| paywall | ||
| price_details | ||
| private | ||
| published | ||
| rating | ||
| ratings_total | ||
| recurrence | ||
| rental_duration | ||
| rental_price | ||
| rental_price_formatted | ||
| soundtrack_info | ||
| start_time | ||
| end_time | ||
| status | ||
| swf_url | ||
| sync_allowed | ||
| tags | ||
| taken_time | ||
| サムネイル | thumbnail_large_url | |
| thumbnail_medium_url | ||
| thumbnail_small_url | ||
| thumbnail_url | ||
| title | 動画タイトル | |
| type | ||
| upc | ||
| url | 動画ページのURL | |
| 閲覧数 | views_last_day | |
| views_last_hour | ||
| views_last_month | ||
| views_last_week | ||
| views_total |
fieldsを指定しないときには、
の4つのフィールドが返されます。
対象とする地域によって、サポートされるパラメータが異なります。
| パラメータ | 対象地域 | ||||
|---|---|---|---|---|---|
| 日本 (jp) |
International (en) |
United States (us) |
United Kingdom (gb) |
France (fr) |
|
| animals | 動物 | Animals | Animals | Animals | Animaux |
| auto | 自動車-バイク | Auto-Moto | Auto-Moto | Auto-Moto | Auto et Moto |
| creation | 芸術/創作 | Arts | Arts | Arts | Art et Création |
| fun | ユーモア | Funny | Funny | Funny | Humour |
| kids | × | × | × | × | Kids |
| gaylesbian | × | × | × | Gay & Lesbian | × |
| latino | × | × | Latino | × | × |
| lifestyle | ライフ&スタイル | Lifestyle | Lifestyle | Lifestyle | Lifestyle |
| music | ミュージック | Music | Music | Music | Musique |
| news | ニュース&政治 | News | News | News & Politics | Actu et Politique |
| people | 人&家族 | Celeb | Celeb | People & Family | Amis et Famille |
| school | キャンパス | College | × | College | Campus |
| sexy | セクシー | Sexy | Red Band | Sexy | Sexy |
| shortfilms | 映画&TV | Movies | Movies | Film & TV | Cinéma |
| sport | スポーツ&Xスポーツ | Sport | Sports | Sport | Sports et Extrême |
| tech | テクノロジー&科学 | Tech | Geek Out | Tech & Science | High-tech et Science |
| travel | 旅行 | Travel | Travel | Travel | Voyages |
| tv | × | × | TV | × | TV |
| videogames | ゲーム | Gaming | Gaming | Gaming | Jeux vidéo |
| webcam | ウェブカム&動画ブログ | Webcam & Vlogs | × | Webcam & Vlogs | Expression Libre |
| パラメータ | 並べ替えの基準 | |
|---|---|---|
| recent | ||
| 再生数※1 | visited | 再生数 |
| visited-hour | ||
| visited-today | ||
| visited-week | ||
| visited-month | ||
| コメント数 | commented | |
| commented-hour | ||
| commented-today | ||
| commented-week | ||
| commented-month | ||
| 評価 | rated | 評価 |
| rated-hour | ||
| rated-today | ||
| rated-week | ||
| rated-month | ||
| relevance | 関連性 | |
| random | ||
| ranking |
※1 再生数は、searchやtagsなど一部のパラメータとは同時に指定できないことがあります。そのような場合にはステータスが404で、レスポンスが
{"error":{"code":404,"message":"","type":"not_found"}}
のように返されます。いくつかの組み合わせについて、以下に列挙します。
API Explorer (/videos)では同様の指定は問題ないことから、指定方法の誤りではないと考えられます。なおAPI Explorerでは、
https://api.dailymotion.com/
に対して、
[{"call":"GET /videos","args":{"search":"test","sort":"visited"},"id":0}]
のようにPOSTでリクエストしており、これを模倣してリクエストすれば、正常に結果を得られます。ちなみにPHPならば、それは次のようになります。
$url = 'https://api.dailymotion.com/';
$params = '[{"call":"GET /videos","args":{"search":"test","sort":"visited"},"id":0}]';
$ch = curl_init( $url );
curl_setopt( $ch, CURLOPT_POST, TRUE );
curl_setopt( $ch, CURLOPT_POSTFIELDS, $params );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, TRUE );
curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, FALSE );
echo curl_exec( $ch );
curl_close( $ch );
| プロパティ | 説明 |
|---|---|
| page | ページ番号 |
| limit | 取得する項目の最大数 (リクエストで指定した値) |
| total | 結果の総数 |
| explicit | 露骨な動画を含むとき、true |
| has_more | 次のページがあるとき、true |
| list | 結果リスト 結果リストのプロパティについては、fieldsパラメータを参照してください。 |
has_moreがtrueであっても、pageに100を超える数値を指定すると、「Too high value `101`, max allowed value is `100` for `page' parameter」としてHTTPステータス400が返されます。
{
"page" : 1,
"limit" : 10,
"total" : 12278,
"has_more" : true,
"list" : [
{
"id" : "xw2qfr",
"title" : "New to App Store: Cook Happy Video Cookbook Sampling 23 Free Recipes",
"channel" : "lifestyle",
"owner" : "x18mjcd"
},
{
"id" : "xw2s4i",
"title" : "Sample from wreck it ralph",
"channel" : "shortfilms",
"owner" : "x7e5f"
},
{
"id" : "xw25fa",
"title" : "Reverse Logistics Market in India 2012-Sample",
"channel" : "news",
"owner" : "x17u16r"
},
{
"id" : "xw259j",
"title" : "Photovoltaic Generator Market in India 2012-Sample",
"channel" : "news",
"owner" : "x17u16r"
},
{
"id" : "xw24y2",
"title" : "Insulator Market in India 2012 - Sample",
"channel" : "music",
"owner" : "x17u16r"
},
{
"id" : "xw21py",
"title" : "Single Room for 1 pax",
"channel" : "lifestyle",
"owner" : "xqjawg"
},
{
"id" : "xw1poc",
"title" : "\"HTTP:\/\/MIXMATCHSWAP.COM\" NEW BEAUTY BOX \"HTTP:\/\/WWW.MIXMATCHSWAP.COM\" NEW BEAUTY BOX",
"channel" : "lifestyle",
"owner" : "x18pnl4"
},
{
"id" : "xw1org",
"title" : "8 1:2 SAMPLE",
"channel" : "shortfilms",
"owner" : "x18tkqo"
},
{
"id" : "xw1r9h",
"title" : "The Mysterious Montague A True Tale of Hollywood, Golf, and Armed Robbery (Unabridged) audiobook sample",
"channel" : "music",
"owner" : "x19if28"
},
{
"id" : "xw1r9b",
"title" : "Black Out A Novel (Unabridged) audiobook sample",
"channel" : "music",
"owner" : "x19if28"
}
]
}