How to write FQL to fetch news feeds

2019-05-28 16:48发布

问题:

I have to fetch all data which is on News Feeds (public wall). What query should I write ? I wrote "SELECT likes,message FROM stream WHERE source_id = %lld limit 50 " query but it is returning my wall value. I want to fetch all data which is on my wall as well as on public (News Feed).

Thanks in advance

回答1:

You need to use the filter_key to select the type of feed to use. The type you are after would probably be newsfeed, so the query could be something like this:

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')

For more information, have a look at the stream_filter docs.



回答2:

How about doing it without querying FQL? :)

Use the Graph API instead:

https://graph.facebook.com/me/home?access_token=...

Try it on using "Graph API Explorer". /me/home