可以访问此信息。可以通过以下权限看到关系状态更新: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检查更新的答案。 –