Facebook Graph API - 获取URL的ID? [英] Facebook Graph API - get ID for a URL?

查看:148
本文介绍了Facebook Graph API - 获取URL的ID?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Graph API 看来,这似乎是一件非常明显的基本事情,但我有严重的困难。我想做的是获取任何特定URL的ID。他们有一个方法:

This seems like a pretty obvious, basic thing to expect from the Graph API, but I'm having serious difficulty with it. All I want to do is get the ID for any particular URL. They have a method for this:

https://graph.facebook.com/?ids=http://www.imdb.com/title/tt0117500/

这很好。但是如果我尝试另一个URL,对我的博客来说,

And that works great. But if I try another URL, say for my blog,

https://graph.facebook.com/?ids=http://dusda.vox.com

它不会给我一个数字ID像所有例子。而是:

it doesn't give me back a numerical ID like all of the examples do. Instead, this:

{"http:\/\/dusda.vox.com":{"id":"http:\/\/dusda.vox.com"}}

如果我尝试使用id,我得到jack(可能是因为查询字符串看起来不可能解析):

If I try to use that "id", I get jack (probably because the query string looks impossible to parse):

Request: https://graph.facebook.com/http://dusda.vox.com/likes
Response: {"id":"http:\/\/dusda.vox.com\/likes"}

那么这是什么呢? Graph API只是选择性可靠,还是我误会了一些东西?我已经尝试过,我知道在Facebook上很受欢迎的网址,我得到了混合的结果。

So what's up with this? Is the Graph API just selectively reliable, or am I misunderstanding something? I've tried it on URLs that I know are popular on Facebook, too, and I've gotten mixed results.

推荐答案

该ID仅由具有fbshare / like按钮的页面提供给Facebook。否则API会返回共享数量和请求URL。

The ID is given by Facebook only to pages which have a fbshare/like button. Else the API returns the number of shares and the request URL.

这篇关于Facebook Graph API - 获取URL的ID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆