[英]Facebook Graph Api - Retrieve only Wall posts that contain a photo
我需要從Facebook檢索給定帳戶的牆貼,但我只對包含照片的帖子感興趣。 有沒有辦法將這樣的過濾器添加到Facebook圖形API查詢? 就像是:
https://graph.facebook.com/DigitasLBiNL?fields=feed&type=photo
Facebook數據包含一個type
屬性作為photo
返回,所以我認為這是可能的,但我沒有任何運氣通過Facebook sdk文檔或修補。
我知道我可以自己進行過濾,但我更願意保留facebook返回的paging
屬性。
邊緣
/{user_id}/home
( https://developers.facebook.com/docs/graph-api/reference/v2.1/user/home#read )
/{user_id}/feed
( https://developers.facebook.com/docs/graph-api/reference/v2.1/user/feed#read )
應該(根據文檔)都能夠采用filter
參數,包含來自stream_filter
FQL表的過濾鍵( https://developers.facebook.com/docs/reference/fql/stream_filter/ )。
如果我運行FQL
select name, value, type, filter_key from stream_filter where uid=me()
我得到以下結果:
{
"data": [
{
"name": "News Feed",
"value": null,
"type": "newsfeed",
"filter_key": "nf"
},
{
"name": "Status Updates",
"value": 2915120374,
"type": "application",
"filter_key": "app_2915120374"
},
{
"name": "Photos",
"value": 2305272732,
"type": "application",
"filter_key": "app_2305272732"
},
{
"name": "Links",
"value": 2309869772,
"type": "application",
"filter_key": "app_2309869772"
},
{
"name": "Pages",
"value": null,
"type": "public_profiles",
"filter_key": "pp"
},
{
"name": "Video",
"value": 2392950137,
"type": "application",
"filter_key": "app_2392950137"
},
{
"name": "Notes",
"value": 2347471856,
"type": "application",
"filter_key": "app_2347471856"
},
{
"name": "Groups",
"value": 2361831622,
"type": "application",
"filter_key": "app_2361831622"
}
]
}
因此,如果我選擇app_2305272732
作為照片的篩選鍵,則可以成功運行以下圖表API請求:
/me/home?filter=app_2305272732&limit=3
這給了我來自新聞提要的三個最新照片。
您想對用戶/頁面供稿執行此操作(根據https://developers.facebook.com/docs/graph-api/reference/v2.1/page/feed#read上的文檔,不支持對頁面進行過濾) ,所以我試過這個:
/me/feed?filter=app_2305272732&limit=3
不幸的是,這不僅返回照片帖子,至少對我而言。 所以我認為這是Facebook Graph API中的一個錯誤。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.