如何使用图形api从用户的Facebook新闻源中仅获取照片?

TMC*_*TMC 2 javascript facebook facebook-fql facebook-graph-api

我梳理了Facebook文档,但没有看到一个明显的方法只返回用户新闻源上的照片.特别:

提供FB访问令牌,我想将新闻源过滤到仅发布的照片​​.

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

返回整个新闻源.我看到元素有一个"Type"属性,当它是一张照片时,它的值为"photo".

如何将响应范围仅限于返回照片?

Moz*_*ris 5

当然,你可以使用FQL来做到这一点:

SELECT 
    post_id, message, attachment 
FROM 
    stream 
WHERE 
    filter_key 
IN (
    SELECT 
        filter_key 
    FROM 
        stream_filter 
    WHERE 
        uid = me() 
    AND 
        name = "Photos"
   )
Run Code Online (Sandbox Code Playgroud)

使用Graph API Explorer进行演示: https://developers.facebook.com/tools/explorer?method=GET&path=fql%3Fq%3DSELECT%20post_id%2C%20message%2C%20attachment%20FROM%20stream%20WHERE%20filter_key%20IN%20(SELECT%20filter_key%20FROM%20stream_filter%20WHERE%20uid%3Dme()%20AND%20name%3D%22Photos%22)

编辑:

看起来该链接不起作用.这是对图api的请求.你需要read_stream权限.

https://graph.facebook.com/fql?q=SELECT post_id, message, attachment FROM stream WHERE filter_key IN (SELECT filter_key FROM stream_filter WHERE uid=me() AND name="Photos")