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

查看:28
本文介绍了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 上很受欢迎的 URL 上尝试过,但结果喜忧参半.

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 仅由 Facebook 提供给具有 fbshare/like 按钮的页面.否则 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天全站免登陆