Search code examples
facebookfacebook-graph-apifacebook-php-sdk

Facebook Api issue with the video source, missing source key


Hello i am using facebook php sdk to extract the facebook page video media, i do it like:

$response= $facebook->api("/" . MYPAGENAME . "/feed?

fields=location&locale=en_GB&

fields=type,message,id,story,link,created_time,attachments,source,name,picture,object_id,place&limit=20");

Now in the $response i am getting the image src in the src node return by the facebook reponse but the source key is missing, response shown below:

[data] => Array
(
    [0] => Array
        (
            [type] => video
            [message] => msg something.
            [id] => 123_45
            [link] => https://pageLink/videos/123/
            [created_time] => 2018-01-17T18:23:14+0000
            [attachments] => Array
                (
                    [data] => Array
                        (
                            [0] => Array
                                (
                                    [media] => Array
                                        (
                                            [image] => Array
                                                (
                                                    [height] => 720
                                                    [src] => https://scontent.xx.fbcdn.net/v/t15.0-10/s720x720/3232_123_66666_n.jpg?_nc_cat=0&oh=6dbab817f240396da&oe=5C08F2
                                                    [width] => 576
                                                )

                                        )

                                    [target] => Array
                                        (
                                            [id] => 123
                                            [url] => https://pageLink/videos/123/
                                        )

                                    [type] => video_inline
                                    [url] => https://pageLink/videos/123/
                                )

                        )

                )

            [picture] => https://scontent.xx.fbcdn.net/v/t15.0-10/s720x720/3232_123_66666_n.jpg?_nc_cat=0&oh=442dbab817f240396da&oe=808F2
            [object_id] => 123
        )

)

You can see here at data->0->attachments->data->0->media there is no any source key exist for type video by which i am not able to get the video access link.

how can i get the missing source please help me out.


Solution

  • I got the answer facebook feed has stopped to send source for a video since 30 July 2018 Through it's official developer site-

    As of April 30, 2018, the source field for /page/feed and /page/posts will no longer be returned for Page-owned videos unless the User making the request has a role on the owning Page.

    `https://developers.facebook.com/docs/graph-api/reference/v3.1/page/feed#readperms