How to get the video thumbnail from Dailymotion video from the video id of that video like in youtube?

前端 未结 4 1682
忘掉有多难
忘掉有多难 2020-12-14 08:58

For youtube I use something like this:

/0.jpg\" alt=\"\" widt         


        
相关标签:
4条回答
  • 2020-12-14 09:09
    $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
    
    0 讨论(0)
  • 2020-12-14 09:21

    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

    0 讨论(0)
  • 2020-12-14 09:28

    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}
    
    0 讨论(0)
  • 2020-12-14 09:31

    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

    0 讨论(0)
提交回复
热议问题