Is it possible to get User feed with FQL?
-
13-07-2021 - |
Question
Is it possible to use FQL to get user's feed? To get the same like graph.facebook.com/user/feed
Solution
The request mentioned in cpilko's answer will get you the current user's Newsfeed (i.e. the equivalent of Graph API's /me/home). Therefore I don't think that answer should have been accepted.
As for the current user's Timeline (i.e. the equivalent of Graph API's /me/feed): There is no easy way to get this with only one request because the Timeline contains different pieces of information:
- It contains status updates by the current user.
- It contains posts by other users that are targeted to the current user.
- It does NOT contain posts by the current user targeted to other users, events, etc.
- It does NOT contain stories by the current user that have neither a message text nor an attached photo, link, or place.*
*: I'm not 100% sure on the last one because information on this is sketchy at best. There are different post types (a complete list of which I haven't seen yet), and there seems to be some kind of logic which types are shown on the Timeline and which are not. As I said, documentation is sketchy and it seems like Facebook doesn't want you to get exactly the same data as they do.
Now to answer your question: If you're planning to offer a user's Timeline as part of your app experience, you should probably aim at a best-guess approach.
Here is an example that I find comes pretty close (except that it doesn't get you posts of friends on your Timeline, but as I said: best-guess):
SELECT post_id, actor_id, target_id, description, message, attachment, type, permalink FROM stream WHERE source_id = me() AND is_hidden != "true" AND (type = 46 OR type = 60 OR type = 65 OR type = 80 OR type = 128 OR type = 247 OR type = 285 OR type = 373) LIMIT 100
By the way, this is the most complete list of post types I have found so far: Where to get a list of ALL facebook stream posts types?
Hope this helps, even though the answer admittedly isn't that encouraging. :)
OTHER TIPS
The equivalent table in FQL is stream. This query gets you the active user's news feed.
SELECT post_id, actor_id, target_id, message FROM stream WHERE filter_key in (SELECT filter_key FROM stream_filter WHERE uid=me() AND type='newsfeed') AND is_hidden = 0
You should do on this way
SELECT post_id, created_time, actor_id, target_id, message FROM stream WHERE source_id='SOURCE_ID' AND created_time<1225705644 LIMIT 150
set SOURCE_ID with your friend's id.
I think you should try in following way: see if it helps.
SELECT post_id, actor_id, type, permalink, message, created_time, likes, comment_info FROM stream WHERE source_id = me() AND app_id = AppID
If you pass app id then it will return your friends feed posted from that app only.