Get Facebook video thumbnail image URLs?

て烟熏妆下的殇ゞ 提交于 2019-12-11 07:01:36

问题


We can get the video thumb of YouTube videos by using the video ID in an URL the way defined below

$src = "http://img.youtube.com/vi/".$video_id."/default.jpg";               

Similarly, how can I get the video thumb of Facebook videos? Is there any predefined URL in which we put the Facebook video ID and get the as like youtube defined in the way above?


回答1:


Trying to do this as well but it does not appear so. Example: a video I have on a Page with ID "1015030122022040" has a thumbnail url of:

http://vthumb.ak.fbcdn.net/hvthumb-ak-ash2/51388_10150301225830401_10150301220220401_62962_1470_t.jpg

While another video with ID: 10150361184550401 has a thumbnail url of: http://vthumb.ak.fbcdn.net/hvthumb-ak-snc4/162098_10150361242815401_10150361184550401_35242_2053_t.jpg

I looked through others and found no obvious pattern. You can however do an FQL to return the array of videos by uid.

Using some code from a tutorial, I edited the "sql query example" in Step Three to this:

try {
    //get user id
    $uid    = $facebook->getUser();
    //or you can use $uid = $fbme['id'];

   $fql = "SELECT vid, owner, title, description, thumbnail_link, embed_html, updated_time, created_time FROM video WHERE owner=" . $uid;

    $param  =   array(
        'method'    => 'fql.query',
        'query'     => $fql,
        'callback'  => ''
    );
    $fqlResult   =   $facebook->api($param);
}
catch(Exception $o){
    d($o);
}

Then from his example was able to the view the arrays <?php d($fqlResult); ?>

And grabbed my most recent video thumbnail thusly:

<img src="<?php echo $fqlResult[0][thumbnail_link]; ?>" />



回答2:


check this :http://www.cutevideoclub.com/php/facebook-video-thumbnail-with-video-id-php/

   
$fbvideoid="158952527492492";
    $fql2 = "SELECT vid, owner, title, description, thumbnail_link, embed_html, updated_time, created_time FROM video WHERE vid=" . $fbvideoid;

use above query for detail see ref site:http://www.cutevideoclub.com/php/facebook-video-thumbnail-with-video-id-php/

or click here facebook video thumbnail with video id php



来源:https://stackoverflow.com/questions/4848195/get-facebook-video-thumbnail-image-urls

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!