[英]Get image's URL from page's photos using Facebook Graph API (Javascript)
[英]How to get only photos from user's Facebook newsfeed using graph api?
我浏览了Facebook文档,但没有找到一种明显的方法来仅返回用户新闻源中的照片。 特别:
给一个FB访问令牌,我希望将新闻提要过滤为仅发布的照片。
https://graph.facebook.com/me/home?access_token=
返回整个新闻源。 我看到元素具有“类型”属性,当它是照片时,其值为“照片”。
如何确定响应范围,使其仅返回照片?
当然,您可以使用FQL执行此操作:
SELECT
post_id, message, attachment
FROM
stream
WHERE
filter_key
IN (
SELECT
filter_key
FROM
stream_filter
WHERE
uid = me()
AND
name = "Photos"
)
使用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)
: 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)
fql%3Fq%3DSELECT%20post_id%2C%20message%2C%20attachment%20FROM%20stream%20WHERE%20filter_key% 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")
Facebook已经增加了一个过滤器参数来/me/home endpoint
,所以如果你查询/me/home?filter=photos
你从用户只能照片News Feed
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.