Retrieving public videos through Graph API - facebook

We are using the Facebook Graph API to search for Public Posts as per the following query:-
"https://graph.facebook.com/search?q=" sSearchText
We have found that this query is currently returning only public posts related to status updates. It is not returning posts which contain videos. Could you kindly let us know as to how we can retrieve the same?

You need to use FQL as opposed to the Graph API. Details on how to query Facebook for video objects can be found at the link below:
https://developers.facebook.com/docs/reference/fql/video
See this existing question for more details: Facebook Graph API and videos

Related

How to get top global public posts with most number of likes from facebook using fql

I want to get top global public posts from facebook with most number of likes using fql, is there anyway to do it?
I am able to get the posts for a specific page and actor.
SELECT message, likes.count, attachment FROM stream WHERE
source_id='SOURCE_ID' AND actor_id= 'ACTOR_ID'
but is there anyway like using queries like max(likes)
Short Answer: No
FQL is deprecated
Public Post Search is deprecated
Public Feed API is restricted to a limited set of media publishers and you cannot apply (at least not right now)
Links:
https://developers.facebook.com/docs/apps/changelog
https://developers.facebook.com/docs/public_feed

How to count likes/comments of a photo/post using new Facebook Graph API 2.1?

I tried for several hours to get the total number of likes/comments of a photo/post using the new Facebook Graph API 2.1 but I didn't find how to do it.
I am able to photo and post details through the API but it contains only an subarray with some likes and comments (ID/Name pair), but no the total number. Graph API Reference for object/likes mention a total_count field but is not able to found in API response.
Can you please suggest me a way to do it?
I am using latest Facebook PHP SDK 4.
I faced this situation before. Facebook Graph API Explorer, in the Fields dropdown list, you can not find any field related to total_like or total_comment of a specific post ( via its object_id). That means Facebook Graph API does not support getting the total likes, comments of a specific post.
But, it support to get likes, comments data of a post via likes, comments fields. So by this way, you can get the entire data about likes, comments, therefore, you can get the total number of likes/comments. This solution is not good, I think. I think in the near feature, Facebook Graph API support the fields total_likes, total_comments.
/object_id?fields=comments.limit(1000),likes.limit(1000)

Graph API SEARCH not returning public posts done on a page

I'm trying to get posts with a certain keyword (in fact, a hashtag), but I'm not receiving all posts. For example, there are a lot of posts done by users on a certain page that are not being pulled although they're public. The call I do is similar to this one:
https://graph.facebook.com/search?type=post&q=keyword&access_token=XXXXX
Not sure if this type of posts are considered public but only retrievable by specifying the page:
https://graph.facebook.com/PAGE_ID/feed?access_token=XXXXX
But I need to retrieve all public posts containing a certain keyword and I don't know exactly which pages could users post to with this hashtag...
Be aware that Facebook has just taken down public post search in Graph API v2.0 so you won't be available to do that anymore.
Check https://developers.facebook.com/docs/apps/upgrading under section Graph API "Public post search is no longer available. (/search?type=post&q=foobar)"

How can I make my timeline with Graph API?

I've studied Facebook API for several hours, and googled lots of pages. But I can not find the way get posts list just like my timeline on Facebook app.
I would like to make a Web app that show my timeline posts just like Flipboard. I found an API to get my "story" and "my friends list". But I can not even imagine how to retrieve my friend post that shown on my timeline.
Is it impossible to replicate my timeline on my web app? Only Flipboard can do that? Do you have any hint?
To access the current User's News Feed use the "User/Home" request as described in the API Documentation.
In order to gain access to the User's News Feed you will be required to gain the "read_stream" permission. For information on how to request the appropriate permission, read the Login, authorization and permissions section of the Getting Started guide.
The request to me/home will return an array of News Feed items, which are comprised of statuses, pictures, likes, etc. You can see an example of the result by using the Graph API Explorer.
Compare the results to your Timeline and they should be nearly identical (currently I believe Ads/Promoted Posts are excluded from the API)"
Play around with the Graph API Explorer:
https://developers.facebook.com/tools/explorer/?method=GET&path=me%2Fhome
I had to change the permissions within the App and specifically give myself 'read_stream' access, but once that was complete I was able to run a '/me/home' Graph API GET Request and return a representation of my timeline. Good luck!
You can get the timeline this way:
$fb = new Facebook('{config}');
$fb->setDefaultAccessToken('{getAccesstoken}');
$request = $fb->get('/me?fields=feed.limit(10000){link}');
//
$graphObject = $request->getGraphNode();
return $graphObject;

Find related facebook interests using graph API

I'm trying to figure out a way find related interests on Facebook. E.g. I want to search for Cityville and result should be Farmville, Castleville etc.
Is there an API to support this, what are the alternatives?
You can search the JSON result by the Graph API with the url https://graph.facebook.com/me/likes?access_token={your_token_here}, replacing the "me" with the Facebook User ID/Name.
If you are looking for pages search, you can use the same API, with the url https://graph.facebook.com/search?q={keyword}&type=page&access_token={your_token_here}.