20

For youtube I use something like this:

<img class="video-thumbnail" src="http://img.youtube.com/vi/<?php echo $video_id; ?>/0.jpg" alt="" width="190">

where

$video_id is the code of that video from url.

Can I do something similar for Dailymotion videos

ChatGPT
  • 5,334
  • 12
  • 50
  • 69
Derfder
  • 3,204
  • 11
  • 50
  • 85

4 Answers4

47

You just need to add an extra thumbnail into the link.

Video URL

https://www.dailymotion.com/video/{video_id}

Thumbnail URL

https://www.dailymotion.com/thumbnail/video/{video_id}
Matt R. Wilson
  • 7,268
  • 5
  • 32
  • 48
Ravi
  • 2,078
  • 13
  • 23
14

Using the Dailymotion API

https://api.dailymotion.com/video/VIDEO_ID?fields=field1,field2,...

Replace field1,field2 with

thumbnail_large_url (320px by 240px)
thumbnail_medium_url (160px by 120px)
thumbnail_small_url (80px by 60px)

This API request does not require any Access Tokens.

Example : https://api.dailymotion.com/video/xjfn0s?fields=thumbnail_small_url

This HTTP request returns a JSON data with the image link of the video. For processing JSON data check PHP Manual - JSON Decode

EDIT As suggested by Ravi using http://www.dailymotion.com/thumbnail/video/video_id is pretty straight forward. But different resolution images use the API

  • Greets, where can I see, the list of all availible field options, if there is even such place? – Max Yari Oct 16 '14 at 16:40
  • oh, kind of find it, you can just put wrong parameter in field value, and in debug message there is full list of acceptable values – Max Yari Oct 16 '14 at 16:52
  • 1
    @MaxYari here https://api.dailymotion.com/video/x26ezrb?fields=thumbnail Some size properties are thumbnail_360_url, 480, 720 – Deepak Kamat May 19 '16 at 15:41
  • 1
    Theses fields are deprecated : https://developer.dailymotion.com/api#playlist-fields-deprecated use : https://api.dailymotion.com/video/xjfn0s?fields=thumbnail_url as described here -> https://developer.dailymotion.com/api#video-fields – sami ghazouane Sep 19 '16 at 08:27
  • Like Sami said, theses fields are deprecated. You should now use fields `thumbnail_url` or `thumbnail_360_url` or `thumbnail_720_url` and so on. As described [in dailymotion api documentation](https://developer.dailymotion.com/api#video-fields) – Guillaume Gendre Sep 22 '16 at 07:46
  • To get all possible fields, pass some bogus value - will return error with allowed values, ie: https://api.dailymotion.com/video/xjfn0s?fields=will-give-error – PeterM Dec 07 '16 at 10:15
5
$id='xwxadz'; // ID DAILYMOTION EXAMPLE
$thumbnail_medium_url='https://api.dailymotion.com/video/'.$id.'?fields=thumbnail_medium_url';
$json_thumbnail = file_get_contents($thumbnail_medium_url);
$get_thumbnail = json_decode($json_thumbnail, TRUE);
$thumb=$get_thumbnail['thumbnail_medium_url'];
echo $thumb; // Output Example : http://s2.dmcdn.net/BJL4o/160x120-mzR.jpg
Anass
  • 2,101
  • 2
  • 15
  • 20
0

Just a simpler way for above objective. Suppose following is the url that I want to download thumbnail

http://www.dailymotion.com/video/x17pcar_hadoop-tutorial-how-to-index-and-search-data-with-solr_tech

From this url get last string and Extract string id

x17pcar_hadoop-tutorial-how-to-index-and-search-data-with-solr_tech

Now split above string on underscorebasis (_). First one is video id i.e. x17pcar

Now run following url using id to get thumbnail

http://www.dailymotion.com/thumbnail/video/x17pcar

Hafiz Muhammad Shafiq
  • 8,168
  • 12
  • 63
  • 121