使用FQL获取所有用户的喜好(所有这些) [英] Get all of a user's likes (all of them) with FQL

查看:109
本文介绍了使用FQL获取所有用户的喜好(所有这些)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用FQL获取所有用户的喜好。以下是我的研究,包括我尝试过的和每次尝试的问题。



1)最简单的方法是查询uid上的表。所以这会返回57(对我来说)喜欢其他人的流。

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

XML看起来像这样(注意不清楚没有post_id)

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

上面看来似乎是一个合乎逻辑的步骤,但Facebook ,因此我无法使用下面的代码来获取更多的细节。这个代码不起作用。

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

2)使用Graph API:/ me / likes /检索95个粉丝页面的信息,但不能从照片,视频,链接,或离线内容。完整的网址是: https://graph.facebook.com/me/likes?access_token= <例如:

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

3)此FQL返回与上述代码相同的95个粉丝页面:

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

所以总结一下,理想情况下,我可以返回每一个都喜欢au ser,不管对象。尽管如此,如果我可以将所有数据与数据一起返回,还可以通过一个FQL查询向前推进一下粉丝页面和流式文章。



有什么建议么?我会补充说,我试图这样做,而不使用REST API,因为它将被降级(有一天?),所以因此使用 fql.multiquery 不是一个选项。

解决方案

我已经能够使用FQL来获得一些但不是全部的流。请参阅: http://facebook.stackoverflow.com/questions/8496980/ fql-like-table-not-returns-any-results



我的查询是:



1)给我在页面Feed上喜欢的流项目:

  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)给我流项目我'我喜欢我自己发布的饲料:

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

令人讨厌的是我不能从流项目中获取用户喜欢的事件流项目,朋友流项目,组流项目等。即使我拥有该用户的所有权限。这不是我要求的秘密信息。当然,用户可以通过我的应用程序喜欢和删除流项目。只是我无法查询用户已经喜欢的当前流项目的完整列表。


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.

解决方案

I've been able to use FQL to get at some, but not all, of the stream likes. See: http://facebook.stackoverflow.com/questions/8496980/fql-like-table-not-returning-any-results

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.

这篇关于使用FQL获取所有用户的喜好(所有这些)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆