问题
When I make the Graph call https://graph.facebook.com/me/home
, I get back a paged set of the posts on my feed. Recently, I've started to get items that appear to represent things like "John Doe liked a page". They are marked as a link, but if I ask FB for the item, I get back a status post. Here's an example, scrubbed of personal data:
{
application = {
id = 2530096808;
name = Pages;
};
comments = {
count = 0;
};
"created_time" = "2011-08-28T18:54:09+0000";
description = "some text";
from = {
id = xxxxxx;
name = "John Doe";
};
icon = "https://s-static.ak.facebook.com/rsrc.php/v1/yN/r/xCxxxxxxQO.gif";
id = "xxxxxxx_xxxxxxxxx";
link = "http://www.facebook.com/pages/Ted.Smith/xxxxxxxx";
name = "(name of page)";
picture = "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-snc4/276841_xxxxxxxxxx_xxxxx_q.jpg";
type = link;
"updated_time" = "2011-08-28T18:54:09+0000";
}
However, if I ask for this post using the id, I get this:
{
"id": "xxxxx_xxxxx",
"from": {
"name": "John Doe",
"id": "xxxxxxx"
},
"type": "status",
"created_time": "2011-08-28T18:54:09+0000",
"updated_time": "2011-08-28T18:54:09+0000",
"comments": {
"count": 0
}
}
Looking in FB, I see a post that says "John likes (name of page)".
How can I identify these? Why does it first show up as a link then as a status update? Is there any documentation of this "activity" information? There are other examples that come from "John Doe and others changed their profile image" and so forth. I am having to do some very silly, fragile filtering code to remove these until I know how to deal with them.
Help appreciated.
回答1:
I actually have a post asking this exact same question. It has gotten 0 responses since I posted it almost a week ago.
So, from my research and testing, here are the answers to your questions.
1) You can not identify MOST of these messages. There are some that come in that if you look at the data will give you an idea perhaps what they are, but you will notice they are lacking some of the data you would need to properly display this update.
2) Certain message do seem to come in randomly as either a status or link type. Most commonly this is in relation to a user becoming friends with another user, or a user updating their profile picture.
3) From as far as I can tell there is no way to properly get the information about these messages. I have tried literally everything I can think of to figure it out. All you can do is Ignore messages that do not include the proper fields filled in for the reported type. For instance, if you get a 'status' type and it contains no message field, it is obviously not really a status message and some sort of sub-type that you probably can not properly display anyways, so just skip it. Just make sure you are viewing the data before you just decided that you cant display it though, as I said some of them despite being reported as the wrong type, do give you enough information to display them.
You will also get useless data when the post would have something to do with a person whom your user is not directly friends with as well.
Hope that helps.
来源:https://stackoverflow.com/questions/7260120/facebook-graph-user-home-feed-now-contains-activities-as-post-items-that-are-d