Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get a user's liked posts on Facebook?

Given an authenticated user, can I find that user's liked posts on Facebook?

I've read about "stories" and "recent activities" but I can't seem to find out how to get this data for a specific user. Any help is appreciated!!

Thanks!!

like image 931
Dante Cullari Avatar asked Nov 03 '22 21:11

Dante Cullari


1 Answers

I hope it will be helpful. In official FB SDK with Graph Api v2.1 there is only one way (because fql is no longer available in 2.1) - for each post you should send request to https://graph.facebook.com/v2.1/{post-id}/likes. You can also use .../{post-id}/likes?limit=XXX. In response you will get an array of likes like this:

data": [
    {
      "id": "xxxxxxxx", 
      "name": "yyyyyy"
    }, 
    ....
]

Next you should try find there your user's id. If it here - user liked this post. If not - user not liked this post. This array also can contain paging data with link to next page with likes.

But here's one little problem - too much time if post contains thousands of likes. We asked Facebook about it recently and now we are waiting for an answer. It works good for posts with less than few thousands likes.

like image 162
Eridana Avatar answered Nov 09 '22 04:11

Eridana