0

如何获取我所有朋友上传的最后 50 张照片?

我尝试在 FQL 中运行此查询:

SELECT pid, src 
FROM photo 
WHERE 
owner IN (SELECT uid1 FROM friend WHERE uid2=me())
OR pid IN (
     SELECT pid FROM photo_tag 
     WHERE subject in (SELECT uid1 FROM friend WHERE uid2=me())
) 
ORDER BY created DESC
LIMIT 50 OFFSET 0

我需要从我所有的朋友那里获得最后 50 张照片,或者我的朋友在哪里被标记...

当我在 API Explorer 中运行它时,我得到一个错误:

{
  "error": "Request failed"
}

我知道我有足够的权限,因为当我运行这两个查询时,我得到了结果:

SELECT pid, src FROM photo WHERE owner =(me())

SELECT uid1 FROM friend WHERE uid2=me()

编辑:我也试过这个..

SELECT pid, caption, aid, owner, link, src_big, src_small, created, modified FROM photo 
WHERE owner IN  ( SELECT uid1 FROM friend WHERE uid2=me() )
and created >= 1377800559 
ORDER BY created DESC LIMIT 100

我怎样才能获得更多信息?不能运行这样的查询吗?

4

2 回答 2

1

芬纳利!!!所有朋友的最后发布的照片​​...

SELECT pid, src, src_small, src_big, target_id, created, backdated_time 
FROM photo where pid in (
    SELECT attachment.media.photo.pid
    FROM stream 
    WHERE filter_key IN (SELECT filter_key FROM stream_filter WHERE uid=me()) AND type = 247
)

如您所见,我最初的方法都是错误的...实际上需要使用stream表格来获取最新帖子..然后可以对其进行过滤以仅发布照片并使用它们pid来获取所有必需的信息!!!耶!

我希望它可以帮助遇到同样问题的其他人..

于 2013-09-09T05:27:55.040 回答
0

我不知道为什么,但这里发生了一件奇怪的事情。当我尝试您的查询时-我得到了

请求失败

然后,在挖掘了一下之后,我SELECT uid2 FROM friend WHERE uid1 = me()用 ID 替换了,查询成功了!

因此,作为一种解决方案,您可以首先尝试获取以下好友列表:

SELECT uid2 FROM friend WHERE uid1 = me()

然后在您的查询中使用此结果作为-

SELECT pid, src 
FROM photo 
WHERE 
  owner IN (ID1, ID2, ID3 ...)
  OR pid IN (
     SELECT pid FROM photo_tag 
     WHERE subject IN (ID1, ID2, ID3 ...)
  ) 
ORDER BY created DESC
LIMIT 50 OFFSET 0

奇怪,但这会起作用!

于 2013-08-30T08:07:01.700 回答