可以訪問此信息。可以通過以下權限看到關係狀態更新:user_relationships
和read_stream
。爲了提取確切的故事(以及相關的評論),但是你必須通過結果來分析,有關係的更新如下:
{
"id": "10000xxxxxxxxxx_2yyyyyyyyyy",
"from": {
"name": "Foo Bar",
"id": "10000xxxxxxxxxx"
},
"story": "Foo Bar went from being \"in a relationship\" to \"single.\"",
"story_tags": {
"0": [
{
"id": 10000xxxxxxxxxxx,
"name": "Foo Bar",
"offset": 0,
"length": 9,
"type": "user"
}
]
},
"actions": [
{
"name": "Comment",
"link": "http://www.facebook.com/10000xxxxxxxxxx/posts/2yyyyyyyyyy"
},
{
"name": "Like",
"link": "http://www.facebook.com/10000xxxxxxxxxx/posts/2yyyyyyyyyy"
}
],
"type": "status",
"created_time": "2012-05-05T07:36:32+0000",
"updated_time": "2012-05-05T07:36:32+0000",
"comments": {
"data": [
{
"id": "10000xxxxxxxxxx_2yyyyyyyyyyy_7zzzzz",
"from": {
"name": "Foo Bar",
"id": "10000xxxxxxxxxx"
},
"message": "YaY",
"created_time": "2012-05-05T07:45:31+0000"
}
],
"count": 1
}
},
當有兩個有關的故事的用戶(比如:XXX是在與YYY的關係中),則'story_tags'
字段將具有包含其他用戶的標識的標籤。
我認爲沒有離婚,分居,喪偶(不確定)的更新。
其他關係的更新可能是(不是全部),如:
Alice is in a relationship with Bob and it's complicated.
Alice is in an open relationship with Bob.
Alice is single.
所以要提取更新,也必須滿足兩個條件:現場'story'
應該存在,它應該包含關鍵詞的關係之一,單身,訂婚或已婚。
一旦你有故事/帖子ID,很容易提取評論。
API調用:
https://graph.facebook.com/me_or_id/feed
https://graph.facebook.com/me_or_id/posts
API調用:https://graph.facebook.com/me_or_id/statuses
沒有得到期望的結果,即使對於user_status
和user_relationship_details
權限。
AFAIK這是目前唯一的方法。
編輯:FQL方式:
在FQL,我們可以查詢stream table。在文檔中提到每個帖子都有一個描述字段,如果它是一個自動生成的帖子,即不是由用戶創建的,例如用戶成爲朋友或關係改變,則該字段不爲空。其他帖子有一個消息字段(和一個null
說明字段)。這個描述字段,我相信類似於圖api方法的story
字段。而這些自動生成的帖子將其type
設置爲9,這在文檔中沒有提及(類型的解釋在那裏,但不是在類型9)。無論如何,我們可以使用這些附加條件進行限制性查詢,並希望獲得正確的數據,我們可能仍需要解析這些數據才能刪除其他故事,但至少要解析的數據會少一些。
查詢:
SELECT post_id, type, description, comments FROM stream WHERE filter_key in (SELECT filter_key FROM stream_filter WHERE uid=me() AND type='newsfeed') AND is_hidden = 0 AND type = 9
你必須再次解析說明字段之前提到的關鍵詞。
注意:出於某種原因,我無法通過這一個查詢獲得評論(評論數組總是空的),但是當我從查詢結果中調用post_id
的圖表api時,我可以獲得評論。
@nickb這是目前唯一的方法,我認爲 –
感謝您的信息!但是,由於您必須從用戶的流中解析出這些內容,是否可以使用FQL直接查詢這些帖子? – nickb
@nickb使用fql檢查更新的答案。 –