Find all the post from my friends - facebook

Is it possible that I can get ALL the posts from my friends via API in facebook? I mean All because I need all of them to search if it contains a keywork. Is it possible?

You can search an individual user's News Feed, restricted to that user's friends, by adding a q argument to the home connection URL:
News Feed: https://graph.facebook.com/me/home?q={KEY}
https://graph.facebook.com/me/home?q={QUERY}&access_token={ACCESS_TOKEN}
Eg: https://graph.facebook.com/me/home?q=facebook&access_token=######

You can do that by using the following FQL query:
SELECT post_id, message FROM stream WHERE source_id IN
(SELECT uid2 FROM friend WHERE uid1 = me()) LIMIT 5000
But you need a valid Access Token with an extended read_stream permission. For testing your FQL queries, you can use Graph API Explorer.

Related

FQL: Select date of the last post of all friends

I'm trying to query the date of the last wallpost for each of my friends using FQL.
I've tried something like this:
SELECT post_id, created_time FROM stream WHERE source_id IN (SELECT uid2 FROM friend WHERE uid1 = me())
However, this does not provide me with the output I am looking for. Furthermore I wonder how to set the LIMIT?
Thank you for your help!
If you have an v1.0 app, you could use
SELECT post_id, created_time FROM stream WHERE source_id IN (SELECT uid2 FROM friend WHERE uid1 = me()) order by created_time desc limit 1
If you have a v2.0 app, you'll only see the posts of the friend which are using the same app. If you're using >v2.0 then you have no chance to use FQL. In general, FQL will be deprecated on August 7th, 2016.
You canĀ“t get the posts of friends anymore, for privacy reasons. Friend permissions are gone: https://developers.facebook.com/docs/apps/changelog
You may want to stop using FQL too, because:
The FQL and REST APIs are no longer available in v2.1

Facebook #Hashtag: How to retrive feed by Hastags?

As we can get feeds of specific user or fan page, I wanted to know that how can I get feeds from specific Hashtag like in twitter by fql or Graph API ?
I am using Facebook SDK 3.5.2
Thanks.
As far as I can tell, searching specific posts by hashtags is currently unavailable.
You can still find posts regarding a #hashtag querying a user's stream for a specific message:
SELECT message
FROM stream
WHERE
(source_id IN (SELECT uid2 FROM friend WHERE uid1 = me()) OR source_id=me() )
AND strpos(lower(message),lower('#hashtag')) >=0

Get only married friends using Graph API

Is there a way to get friends with relationship_status equals Married using Graph API?
I did it using FQL, but some fields aren't equals and I have problems using RestFB with these fields like birthday which have different behaviors using Graph API and FQL.
FQL code do get married friends
SELECT uid, name, relationship_status FROM user WHERE (uid = MY_ID OR uid IN (SELECT uid2 FROM friend WHERE uid1 = MY_ID)) AND relationship_status='Married'
I wanna to do the same with Graph API
Graph API is more clean I think too.
Thanks
You have the exact query to get all married friends.
Just you have to do is call this FQL query using GRAPH API.
See the following blog for more details on how to call an FQL using GRAPH API.
http://developers.facebook.com/blog/post/579/
Also please read my answer to this question to just to fix any possible errors when using 'file_get_contents' in your code (as in the example of the FB blog post)
try this..
https://graph.facebook.com/fql?q=SELECT uid, name, relationship_status FROM user WHERE (uid = me() OR uid IN (SELECT uid2 FROM friend WHERE uid1 = me())) AND relationship_status='Married'.

Get all youtube links shared by current user's facebook friends from the past hour

I am trying to get all youtube links shared by current user's facebook friends from the past hour.
I have found an FQL script that would get the latest 100 links shared by the current user's friends but I am trying to query only for youtube links and for the past hour instead of a limit of 100.
This is the script that I have found. How can I change it?
select link_id, title, url, owner, owner_comment, created_time, picture from link where owner in (select uid2 from friend where uid1 = me() LIMIT 100) ORDER BY created_time DESC
You may have found a limitation of the Facebook API. Was there any pagination information in your response that would allow you to page thru the results?

In Facebook's Graph API, how do I get all the friends of my friends?

I want a list of friends of my friends. Is that possible?
Looks like there's no way to do this anymore. I tried this FQL query:
SELECT uid2 FROM friend WHERE uid1 IN
(SELECT uid2 FROM friend WHERE uid1 = <UID>)
And I get an error message that says this:
Can't lookup all friends of . Can only lookup for the logged in user (), or friends of the logged in user with the appropriate permission
Additionally, there's no friends_friends permission or anything similar. Conversely, you can get your friends' likes using the friends_likes permission, so this looks like an intentional omission.
In essence, it looks like you have to have an install from a given user to get that user's friends.