2

要解决的问题:

  1. 想象一下,我有一个域和相应的网站http://my-awesome-site
  2. 在这个网站上,我有 10,000 页。
  3. 每个页面都有一个 Facebook Like 按钮。
  4. 如何从 Facebook 图表中检索每页的点赞数?

可以使用简单的 GET 请求(例如: google.comgoogle.com/readernews.google.com )查找每个 URL 的总点赞数。但是是否有可能获得整个域的类似列表,按页面细分?结果如下:

{
   "id": "http://my-awesome-site/",
   "shares": 12345
},
{
   "id": "http://my-awesome-site/page1.html",
   "shares": 5678
},

....

{
   "id": "http://my-awesome-site/page10000.html",
   "shares": 9012
}
4

2 回答 2

1

我认为您能做的最好的事情是(使用link_stat 表):

SELECT url, share_count
FROM link_stat
WHERE url IN ("http://my-awesome-site/", "http://my-awesome-site/page1.html"...)

但是,如果您有 10,000 个页面,则必须将其分解为多个请求。但是,您可以使用Batch Requests api 来组合一些请求。

如果这是您所追求的,那么该解决方案应该会大大降低 http 请求的数量。

于 2012-05-15T23:21:01.663 回答
1

您也可以通过 facebook graph 用逗号分隔 ID

https://graph.facebook.com/?ids=http://techcrunch.com,http://mashable.com

结果将是一个 json,如下所示

{
   "http://mashable.com": {
  "id": "http://mashable.com",
  "shares": 14436 
},
"http://techcrunch.com": {
   "id": "http://techcrunch.com",
  "shares": 2144
}
}
于 2012-08-28T02:38:09.210 回答