如何使用图形API获取用户的Facebook newsfeed的照片? [英] How to get only photos from user's Facebook newsfeed using graph api?

查看:206
本文介绍了如何使用图形API获取用户的Facebook newsfeed的照片?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我梳理了Facebook文档,但没有看到一个明显的方式来返回用户的新闻源上的照片。具体来说:



给一个FB访问令牌,我想把新闻素材过滤到只发布的照片​​。



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



返回整个新闻源。我看到这些元素有一个类型属性,当它是一张照片时,它的值为photo。



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

解决方案

当然可以使用FQL:

  SELECT 
post_id,message,attachment
FROM
stream
WHERE
filter_key
IN(
SELECT
filter_key
FROM
stream_filter
WHERE
uid =我()
AND
name =照片

使用Graph API Explorer进行工作演示:
https://developers.facebook的.com /工具/资源管理器方法= GET&安培;路径= FQL%3Fq%3DSELECT%20post_id%2C%20message%2C%20attachment%20FROM%20stream%20WHERE%20filter_key%20英寸%20(SELECT%20filter_key%20FROM%20stream_filter%20WHERE %20uid%3Dme()%20AND%20name%3D%22Photos%22)



编辑: p>

看起来该链接不起作用。这是对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)


I combed through the Facebook documentation but didn't see an obvious way to return ONLY photos on a user's newsfeed. Specifically:

Give a FB access token, I want to get the newsfeed filtered to only photos that were posted.

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

Returns the entire newsfeed. I see that elements have a "Type" attribute, that has a value of "photo" when it's a photo.

How can I scope the response to only return photos?

解决方案

Sure, you can do this using FQL:

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

Working demo using 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)

EDIT:

Looks like that link won't work. This is the request to the graph api. You need read_stream permissions.

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")

这篇关于如何使用图形API获取用户的Facebook newsfeed的照片?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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