Get all of a user's likes (all of them) with FQL
Asked Answered
F

3

12

I'm trying to get ALL of a user's likes with FQL. Following is my research including what I've tried and the problems with each attempt.

1) The most simple method would be to query the table on the uid. So this returns 57 (for me) likes on other's stream.

SELECT object_id, post_id, user_id
FROM like
WHERE user_id = me()

XML looks like this (note unexplained absence of post_id)

<like>
    <object_id>10150695050005313</object_id>
    <post_id></post_id>
    <user_id>xxxxxxxxxxx</user_id>
</like>

The above seems like a logical step, but Facebook doesn't index the user_id field so I can't use the following code to get further details. This code does not work.

SELECT post_id, message
FROM stream
WHERE post_id IN (
    SELECT object_id, post_id, user_id
    FROM like
    WHERE user_id = me()
)

2) Using the Graph API: /me/likes/ retrieves information on 95 fan pages, but not from photos, videos, links, or offline content. The full url is: https://graph.facebook.com/me/likes?access_token=

For example:

{
"data": [
  {
     "name": "BStU",
     "category": "Organization",
     "id": "136978696319967",
     "created_time": "2011-06-29T12:09:17+0000"
  },
  {
     "name": "Euchre",
     "category": "Interest",
     "id": "112355915446795",
     "created_time": "2011-06-29T12:06:07+0000"
  },

3) This FQL returns the same as the above code, 95 fan pages:

SELECT page_id,name
FROM page
WHERE page_id IN (
    SELECT page_id
    FROM page_fan
    WHERE uid=me()
)

So to summarize, ideally I would be able to return every like for a user, regardless of the object. I'm willing to move forward with a mixture of fan pages and stream posts though, if I can return them all, along with the data, with one FQL query.

Any suggestions? I will add that I'm trying to do this without using the REST API because it is going to be degraded (someday?) so therefore using fql.multiquery is not an option.

Fabrizio answered 30/6, 2011 at 0:39 Comment(0)
T
2

I've been able to use FQL to get at some, but not all, of the stream likes. See: http://facebook.https://mcmap.net/q/1012516/-getting-user-likes-of-stream-items-via-fql-posts-comments-pictures-links-etc

The queries I've got are:

1) Gives me stream items I've liked on page feeds:

 SELECT post_id, source_id, message 
   FROM stream 
  WHERE source_id 
     IN (SELECT target_id FROM connection WHERE source_id=me() and is_following=1) 
    AND likes.user_likes=1 
  LIMIT 10

2) Gives me stream items I've liked from my feed that I myself posted:

 SELECT post_id, source_id, message 
   FROM stream 
  WHERE source_id=me() 
    AND likes.user_likes=1 
  LIMIT 10

What's annoying is I cannot get user likes from stream items for Event stream items, Friend stream item, Group stream items, etc. Even though I have every permissions accepted for that user. It's not like I'm asking for secret information. As a matter of course, the user can like and remove likes of stream items via my app. It's just that I cannot query a complete list of the current stream items that have been liked by the user.

Taber answered 11/1, 2012 at 22:17 Comment(0)
W
1

Sorry, you cannot pull all of the likes of a person using the /likes endpoint. We limit it to anything that has a FB page, which is any open graph object, sans articles. For example, if you like an open graph object that has an og:type of article, we don't return that in the graph api likes endpoint.

Whenas answered 19/7, 2011 at 12:50 Comment(6)
HI Jeff, Limiting users' likes of someone else's (private) picture make sense, but why wouldn't a user have access to their likes of things which are public? Essentially this is the same as reddit or stumbleupon, it allows a user to keep track of things they read online, within the social network.Fabrizio
@Jeff, I'm confused, are you saying Facebook will let our app query the like table if, and only if, the authenticated user of our app is an actor, movie or sports team?Taber
No, I'm saying you can pull the likes for anything except articles.Whenas
I'm getting likes back from stream items I've posted myself (which I liked) and also for any stream items I've liked on a page's stream. (You can see the FQL I'm using in the answer I posted to this question). What I'm missing is stream items that I've liked on event streams, group streams, and friend streams. I'm unsure what you mean by "articles". Can you explain what types of likes I can get from them? And how to get them?Taber
This sounds like a different question/issue than the original. Best to open a new question.Whenas
Jeff thank you for your responses. I'm very sorry I'm not understanding what you are saying in relation to articles and actors. I've have posted it under my own question, please see: facebook.#8497480Taber
R
0

Try this FQL query:

SELECT user_id, object_id, post_id, object_type 
FROM like 
WHERE user_id = me()
Rafat answered 3/6, 2014 at 13:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.