且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Facebook API:获取共享帖子ID

更新时间:2023-12-02 16:58:22

在您的URL中 https ://www.facebook.com/alexey.kosov/posts/10203624447732200 10203624447732200是您的公开帖子ID.使用API​​ v2.0 ,您可以获取带有边缘sharedposts的共享帖子:

In your URL https://www.facebook.com/alexey.kosov/posts/10203624447732200 the 10203624447732200 is your public post id. With the API v2.0 you can get the shared posts with the edge sharedposts: https://developers.facebook.com/docs/graph-api/reference/v2.0/object/sharedposts

根据v2.0上的文档:

According to the documentation on v2.0:

对于页面帖子,可以使用任何有效的访问令牌检索页面上的公开帖子.页面上的人员发帖,提及该页面的人员的发帖或目标页面帖子(例如,按语言或地理位置)可能需要用户或页面令牌. 具有read_streamuser_posts permission的其他任何帖子的用户访问令牌

For page posts, public posts by the page are retrievable with any valid access token. Posts by people on the page, posts by people which mention the page, or targeted page posts (by language or geography, for example) may require a user or page token. A user access token with read_stream or user_posts permission for any other posts

因此,您需要具有两个权限之一的令牌.

So you need a token with one of the two permissions.

我试图从您的帖子中检索共享: https://developers.facebook.com/tools/explorer/?method=GET&path=10203624447732200%2Fsharedposts&version=v2.0

I tried to retrieve the share from your post: https://developers.facebook.com/tools/explorer/?method=GET&path=10203624447732200%2Fsharedposts&version=v2.0

它返回了我{"data": []},但是在分享帖子后,我重复了通话,并且能够在结果中看到我刚刚分享的帖子.

And it returned me {"data": []}, however after I shared the post, I repeated the call and I was able to see the post that I just shared in the results.

现在,如果我使用刚刚共享的post_id,我将再次收到一个空结果.因此,您只能看到谁分享了该信息,但看不到别人分享的信息. 如果您将共享帖子视为树的节点,则只能看到具有post_id的节点下的子树上发生的事情.

Now, if I use the post_id that I just shared, I receive again an empty result. So you can see only see who shared the post but not if it was shared from somebody else. If you think of shared posts as nodes of a tree, you can only see what happens on the subtree under the node with the post_id that you have.

您还需要考虑到,您将无法检索您不可见的重新共享的帖子.即:如果我以只有我"的隐私分享您的帖子,或者如果我以朋友"的隐私分享您的帖子,而我们不是朋友,则您将无法看到它.

You also need to consider that you will not be able to retrieve the re-shared posts that are not visible to you. i.e.: if I share your post with privacy "Only me" or if I share it with privacy "Friends" and we are not friends you will not be able to see it.